Primeros bocetos en Processing con Arduino.
1)Titilar un led de la placa o conectado al pin 13.
void setup() {
pinMode(13,OUTPUT);
}
void loop() {
digitalWrite(13,HIGH);
delay(1000);
digitalWrite(13,LOW);
delay(1000);
}
void setup() {
// put your setup code here, to run once:
pinMode (2, OUTPUT);
}
2)Prender 4 segs,prender 2 segs,apagar 1 seg.
void loop() {
// put your main code here, to run repeatedly:
digitalWrite (2, HIGH);
delay (4000);
digitalWrite (2, LOW);
delay (3000) ;
digitalWrite (2, HIGH);
delay(2000);
digitalWrite (2, LOW);
delay (1000) ;
3) 2 leds: prende 2 segs,apaga 2 segs, prende 3, apaga 3.
void setup() {
pinMode(2,OUTPUT);
pinMode(3,OUTPUT);
}
void loop() {
digitalWrite(2,HIGH);
delay(1000);
digitalWrite(2,LOW);
delay(1000);
digitalWrite(3,HIGH);
delay(1000);
digitalWrite(3,LOW);
delay(1000);
}
Boceto 4
void setup() {
pinMode(2,OUTPUT);
pinMode(3,OUTPUT);
}
void loop() {
digitalWrite(2,LOW);
delay(1000);
digitalWrite(3,LOW);
delay(1000);
digitalWrite(2,HIGH);
delay(1000);
digitalWrite(3,HIGH);
delay(1000);
}
Boceto 5
void setup() {
// put your setup code here, to run once:
pinMode (2,OUTPUT);
pinMode (3, OUTPUT);
pinMode (4, OUTPUT);
}
void loop() {
// put your main code here, to run repeatedly:
digitalWrite (4, HIGH);
delay (4000);
digitalWrite (4 ,LOW);
delay (2000);
digitalWrite (3, HIGH);
delay (2000);
digitalWrite (3, LOW);
delay (2000);
digitalWrite (2, HIGH);
delay (4000);
digitalWrite (2, LOW);
delay (2000);
digitalWrite (3, HIGH);
delay (2000);
digitalWrite (3, LOW);
delay (2000);
}
EXCELENTE TRABAJO!!!
ResponderEliminar:-)