VMA209
V. 01 – 12/04/2018 4 ©Velleman nv
digitalWrite(ledPin1, LOW);
digitalWrite(ledPin2, LOW);
digitalWrite(ledPin3, LOW);
delay(1000); // Wait for 1 second
}
7.2 Running LEDs
//*******************************************************************************
//VMA209 RUNNING LED EXAMPLE
//Written on : Arduino IDE
//Compatible with :Arduino Leonardo, Arduino UNO, Mega
//*******************************************************************************/
int BASE = 10 ; //Digital Pin Base = 10, 10 = corresponding with D10
int NUM = 4; // 4 Digital lines are used for 4 LEDs
void setup()
{
for (int i = BASE; i < BASE + NUM; i ++)
{
pinMode(i, OUTPUT); //declare digital pins 10 to 13 as output
}
}
7.3 Push-Button and LED Test
//*****************************************************
// VMA209 Push button and LED test
// written by Patrick De Coninck / Velleman NV.
// VMA209 contains 3 Push buttons, they are connected to the Arduino Analog inputs A1, A2, A3
// in this example we will switch ON LED1 when pushing Push button 3 - please feel free to choose different
buttons or LEDS
//****************************************************
int ledpin=13; //Define integer ledpin with a value of 13
int inpin=A3; //Define integer inpin = analog line A3
int val; // define variable VAL
void setup()
{
pinMode(ledpin,OUTPUT);//Declare ledpin (which has a value of 13) as OUTPUT
pinMode(inpin,INPUT);//Declare inpin (which is analog input A3) as INPUT
}
void loop()
{
val=digitalRead(inpin);//Read the value of Analog line 13 (push button)