Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define led 11
- #define butt_up 8
- #define butt_down 9
- int brigthness = 0;
- void setup() {
- pinMode(led, OUTPUT);
- pinMode(butt_up, INPUT_PULLUP);
- pinMode(butt_down, INPUT_PULLUP);
- }
- void loop() {
- if (digitalRead(butt_up) == 0) {
- brigthness = brigthness + 10;
- } else if (digitalRead(butt_down) == 0){
- brigthness = brigthness - 10;
- }
- if (brigthness > 255) {
- brigthness = 255;
- }
- if (brigthness < 0) {
- brigthness = 0;
- }
- analogWrite(led,brigthness);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement