Button changes colour on object

Hi I am looking to change the colour of an object using an Arduino using a button. I have the Arduino Pin6 set to Input and I have placed this code in hh and have my button wired into pin6 and ground, it does not seem to change colour though? thanks for any help

as well here is my button set up

1 Like

Hello @Dace ! In your case, you forgot to ground the output for the your button. You can use this scheme as an example (I added an LED so that you can check its performance in advance):

Here is an events example:

You can also check your circuit in Arduino IDE in advance (Before you start working with the Ready Maker):

const int buttonPin = 2; 
const int ledPin =    8; 
void setup() {

   pinMode(ledPin, OUTPUT);
   pinMode(buttonPin, INPUT);

void loop() {

   int buttonState = digitalRead(buttonPin);

   if (buttonState == HIGH) {

           digitalWrite(ledPin, HIGH);

   } else {

           digitalWrite(ledPin, LOW);

1 Like

Wow, that was fast and really helpful, I am amazed at how quickly I get a response on here! Thanks so much for your help, this is perfect!


The best place to ask questions :muscle:

1 Like