14
14
Program counter
/ * Detects if connected to the input jack 7 button has been pressed and LED
lights up
* Send the value of the variable ‘Counter’ account via serial port to the PC.
*
*
*/
int LED = 13;
int Button = 7;
int value = 0;
int counter = 0;
int buttonlaststate = 0;
void setup()
{
Serial.begin(9600);
// Con
fi
gures transmission speed to 9600
pinMode(LED, OUTPUT);
// Initializes as a digital output pin 13
pinMode(Boton, INPUT);
// initializes as a digital input the 7
digitalWrite(Boton,HIGH);
// Enable internal resistance Pull-up from PIN7
}
void loop()
{
value = digitalRead(Boton);
// Reads the digital input pin 7 value
digitalWrite(LED, !valor);
// Write in the output the read denied value
if(value != int buttonlaststate){
if(value == 1){
+;