ACKalexandre
hello friends canal new arduino i'm developing project , difficult even, ir control using 2 of same 1 buttons move , down another, 2 manual buttons @ same arduino
objective 5 leds light 1 @ time in sequence button , 1 down. please me.
#include <irremote.h>
int recv_pin = 11;
int pin1 = 10;
int pin2 = 9;
int pin3 = 8;
int pin4 = 7;
int pin5 = 6;
int fase;
int estadobotao;
irrecv irrecv(recv_pin);
decode_results results;
void setup() {
// put setup code here, run once:
serial.begin(9600);
irrecv.enableirin();
pinmode(pin1, output);
pinmode(pin2, output);
pinmode(pin3, output);
pinmode(pin4, output);
pinmode(pin5, output);
pinmode(recv_pin, input);
fase = 1;
}
void loop() {
// put main code here, run repeatedly:
if (irrecv.decode(&results)) {
serial.println(results.value, hex);
if(results.value = 0x20df40bf){
irrecv.resume();
}
estadobotao = digitalread(recv_pin);
if (estadobotao == high) {
if (fase < 5) {
fasesemaforo = fasesemaforo + 1;
} else {
fasesemaforo = 1;
}
}
if (fase == 1) {
digitalwrite(pin1, high);
digitalwrite(pin2, low);
digitalwrite(pin3, low);
digitalwrite(pin4, low);
digitalwrite(pin5, low);
}
if (fase == 2) {
digitalwrite(pin1, low);
digitalwrite(pin2, high);
digitalwrite(pin3,low);
digitalwrite(pin4, low);
digitalwrite(pin5, low);
}
if (fase == 3) {
digitalwrite(pin1, low);
digitalwrite(pin2, low);
digitalwrite(pin3, high);
digitalwrite(pin4, low);
digitalwrite(pin5, low);
}
if (fase == 4) {
digitalwrite(pin1, low);
digitalwrite(pin2, low);
digitalwrite(pin3, low);
digitalwrite(pin4, high);
digitalwrite(pin5, low);
}
if (fase == 5) {
digitalwrite(pin1, low);
digitalwrite(pin2, low);
digitalwrite(pin3, low);
digitalwrite(pin4, low);
digitalwrite(pin5, high);
}
delay(0);
}
}
objective 5 leds light 1 @ time in sequence button , 1 down. please me.
#include <irremote.h>
int recv_pin = 11;
int pin1 = 10;
int pin2 = 9;
int pin3 = 8;
int pin4 = 7;
int pin5 = 6;
int fase;
int estadobotao;
irrecv irrecv(recv_pin);
decode_results results;
void setup() {
// put setup code here, run once:
serial.begin(9600);
irrecv.enableirin();
pinmode(pin1, output);
pinmode(pin2, output);
pinmode(pin3, output);
pinmode(pin4, output);
pinmode(pin5, output);
pinmode(recv_pin, input);
fase = 1;
}
void loop() {
// put main code here, run repeatedly:
if (irrecv.decode(&results)) {
serial.println(results.value, hex);
if(results.value = 0x20df40bf){
irrecv.resume();
}
estadobotao = digitalread(recv_pin);
if (estadobotao == high) {
if (fase < 5) {
fasesemaforo = fasesemaforo + 1;
} else {
fasesemaforo = 1;
}
}
if (fase == 1) {
digitalwrite(pin1, high);
digitalwrite(pin2, low);
digitalwrite(pin3, low);
digitalwrite(pin4, low);
digitalwrite(pin5, low);
}
if (fase == 2) {
digitalwrite(pin1, low);
digitalwrite(pin2, high);
digitalwrite(pin3,low);
digitalwrite(pin4, low);
digitalwrite(pin5, low);
}
if (fase == 3) {
digitalwrite(pin1, low);
digitalwrite(pin2, low);
digitalwrite(pin3, high);
digitalwrite(pin4, low);
digitalwrite(pin5, low);
}
if (fase == 4) {
digitalwrite(pin1, low);
digitalwrite(pin2, low);
digitalwrite(pin3, low);
digitalwrite(pin4, high);
digitalwrite(pin5, low);
}
if (fase == 5) {
digitalwrite(pin1, low);
digitalwrite(pin2, low);
digitalwrite(pin3, low);
digitalwrite(pin4, low);
digitalwrite(pin5, high);
}
delay(0);
}
}
start here
= assign
== to compare (true/false).
https://www.arduino.cc/en/reference/if
please read "how use forum" stickies.
code: [select]
if(results.value = 0x20df40bf){
= assign
== to compare (true/false).
https://www.arduino.cc/en/reference/if
please read "how use forum" stickies.
Arduino Forum > Using Arduino > Project Guidance > ACKalexandre
arduino
Comments
Post a Comment