Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "EEPROM.h"
- int ePromPins[] = {2, 3, 4, 5, 6, 7, 8};
- byte dataValues[] = {0x7E, 0x30, 0x6D, 0x79, 0x33, 0x5B, 0x5F, 0x70, 0x7F, 0x73, 0x77, 0x1F, 0x4E, 0x3D, 0x4F, 0x47};
- int inputPin = 9;
- void setup() {
- Serial.begin(9600);
- // put your setup code here, to run once:
- for (int addr = 0; addr < 16; addr++){
- EEPROM.write(addr, dataValues[addr]);
- }
- for (int i = 0; i < 7; i++){
- pinMode(ePromPins[i], OUTPUT);
- }
- pinMode(inputPin, INPUT);
- }
- void SetBinaryPins(byte val){
- for (int bt = 0; bt < 7; bt++){
- digitalWrite(ePromPins[bt], bitRead(val, bt));
- Serial.print(bitRead(val, bt));
- }
- }
- void loop() {
- // put your main code here, to run repeatedly:
- if (digitalRead(inputPin) == 0){
- for (int i = 0; i < 16; i++){
- byte value = EEPROM.read(i);
- SetBinaryPins(value);
- delay(1000);
- }
- } else {
- for (int i = 15; i >= 0; i--){
- byte value = EEPROM.read(i);
- SetBinaryPins(value);
- delay(1000);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement