Por ello vamos a poner antes de nada el código fuente del archivo .ini.
const int ledA = 11;
const int ledB = 10;
const int ledC = 9;
const int pushButton1 = 7;
const int pushButton2 = 6;
int pushed = 0;
int count = 0;
void setup(){
pinMode( ledA, OUTPUT);
pinMode( ledB, OUTPUT);
pinMode( ledC, OUTPUT);
pinMode( pushButton1, INPUT);
pinMode( pushButton2, INPUT);
}
void loop(){
int pushedA = digitalRead( pushButton1 );
int pushedB = digitalRead( pushButton2 );
if( pushedA == HIGH ){
pushed++;
if( pushed > 4 ) pushed = 0;
analogWrite( ledC, pushed*255/4 );
}
if( pushedB == HIGH ){
count++;
if( count > 4 )
count=0;
switch( count ){
case 1: showCount( 0, 0); break;
case 2: showCount( 0, 255); break;
case 3: showCount( 255, 0); break;
case 4: showCount( 255, 255); break;
}
}
delay(250);
}
void showCount(int a, int b ){
analogWrite( ledA, a );
analogWrite( ledB, b );
}
Y os dejo el videotutorial por si lo quereis seguir.