Skip to content

Instantly share code, notes, and snippets.

@ArthurGuy
Last active August 29, 2015 14:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ArthurGuy/bd91e6b8f675fff61cd5 to your computer and use it in GitHub Desktop.
Save ArthurGuy/bd91e6b8f675fff61cd5 to your computer and use it in GitHub Desktop.
int pin3 = 2; //£1
int pin4 = 3; //£2
int pin5 = 4; //input - coin return
int pin6 = 5; //high - stops money
int pin7 = 6; //5p
int pin8 = 7; //10p
int pin9 = 8; //20p
int pin10 = 9;//50p
void setup() {
pinMode(pin3, INPUT_PULLUP);
pinMode(pin4, INPUT_PULLUP);
pinMode(pin5, INPUT_PULLUP);
pinMode(pin6, OUTPUT);
pinMode(pin7, INPUT_PULLUP);
pinMode(pin8, INPUT_PULLUP);
pinMode(pin9, INPUT_PULLUP);
pinMode(pin10, INPUT_PULLUP);
Serial.begin(9600);
}
void loop() {
//digitalWrite(pin6, true);
if (!digitalRead(pin3)) {
Serial.println("£1");
}
if (!digitalRead(pin4)) {
Serial.println("£2");
}
if (!digitalRead(pin5)) {
Serial.println("Reset");
}
if (digitalRead(pin6)) {
//Serial.println("PIN6");
}
if (!digitalRead(pin7)) {
Serial.println("5p");
}
if (!digitalRead(pin8)) {
Serial.println("10p");
}
if (!digitalRead(pin9)) {
Serial.println("20p");
}
if (!digitalRead(pin10)) {
Serial.println("50p");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment