Stap 2: Code!
In de Arduino app plakken in deze code:
<p>#include "rgb_lcd.h"</p><p>#include <Wire.h></p><p>rgb_lcd lcd;</p><p>const int buttonPin = 2;</p>void setup() { lcd.begin(16, 2); pinMode(buttonPin, INPUT); } int colorR = 25; int colorG = 255; int colorB = 100; void loop() { lcd.setRGB(colorR, colorG, colorB); lcd.clear(); int buttonState = digitalRead(buttonPin); if (buttonState == HIGH) { lcd.write("You can do it!"); int colorG = 255; int colorR = 0; } else { lcd.write("Need motivation?"); int colorR = 255; int colorG = 0; } delay(100); }
Klik op de pijl naar rechts om te uploaden