Go Down

Topic: code with 2 buttons and 2 leds help please :) (Read 521 times) previous topic - next topic


hi, i need help with this code, i have problems at compile!! thankss

Code: [Select]

#include <Button.h>

Button Button1 = Button1(10, INPUT_PULLUP);
Button Button2 = Button2(11, INPUT_PULLUP);

void setup(){
 pinMode (10, INPUT);
 pinMode (11, INPUT);
 pinMode (5, OUTPUT);
 pinMode (6, OUTPUT);

void loop(){
 if (Button1.isPressed()){
  digitalWrite(5, HIGH);
   digitalWrite(5, LOW);
   digitalWrite(6, HIGH);
   digitalWrite(6, LOW);
 else if (Button2.isPressed()) {
    digitalWrite(5, HIGH);
   digitalWrite(5, LOW);


Mar 18, 2018, 09:33 pm Last Edit: Mar 18, 2018, 09:39 pm by GrooveFlotilla
This isn't a bootloader issue, is it?

i have problems at compile!!
But you didn't tell us what they are.
Some people are like Slinkies.

Not really good for anything, but they bring a smile to your face when pushed down the stairs.


i'm sorry it is my first topic, where it should be? :)

this code is for switching direction for massage chair motor using 2 relays
i want when i press the first button to enable relay1 one for 30sec after delay 1sec and enable relay 2 for 30sec delay 1sec again and continue looping this until i press the button2
when i press button 2 i want to enable relay 1 for 30sec and after one loop i want everything stopped until i press again the button1 to start the first loop

thanks everyone for your time!!


i rewrote my topic to the right section
sorry for that :P

Go Up