Created
December 28, 2017 08:53
-
-
Save ValeriyDP/82ead91f32b9688409e6cd720b04b09c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <Wire.h> | |
#include <Arduino.h> | |
#define BUTTON_1 D4 | |
#define BUTTON_2 D5 | |
#define SEGMENT_DRIVER D0 | |
#define SER_IN D1 | |
#define RCK D2 | |
#define SRCK D3 | |
int state; | |
void setup() { | |
pinMode(BUTTON_1, INPUT); | |
pinMode(BUTTON_2, INPUT); | |
pinMode(SEGMENT_DRIVER, OUTPUT); | |
pinMode(SER_IN, OUTPUT); | |
pinMode(RCK, OUTPUT); | |
pinMode(SRCK, OUTPUT); | |
Serial.begin(9600); | |
} | |
void loop() { | |
int val_D4 = digitalRead(BUTTON_1); | |
int val_D5 = digitalRead(BUTTON_2); | |
digitalWrite(SEGMENT_DRIVER, val_D4); | |
digitalWrite(RCK, LOW); | |
shiftOut(SER_IN, SRCK, LSBFIRST, B11110111); | |
digitalWrite(RCK, HIGH); | |
Serial.println("D4: " + String(val_D4)); | |
Serial.println("D5: " + String(val_D5)); | |
Serial.println("------"); | |
delay(500); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment