Blinking LED

<br />

 

Here is a basic example how to use the SensorAktor-Shield within the Arduino environment. Download › SensorAktor.zip and put it into your Arduino libraries folder. We recommend to include the “SensorAktor.h” file in the header of your code, because here pin numbers of the shield are already defined.

 

// import sensor aktor library for pin mapping
#include <SensorAktor.h>

 

Since Arduino 0015 there are some problems with the old “SensorAktor.h” file.

Please use these new keywords instead of the old ones:

 

“a0″ => “analog0″

“a1″ => “analog1″

“a2″ => “analog2″

“a3″ => “analog3″

“a4″ => “analog4″

“a5″ => “analog5″

“s1″ => “switch1″

“s2″ => “switch2″

“s3″ => “switch3″

 

Pin mapping “SensorAktor.h”

 

// analog inputs
#define analog0 A0
#define analog1 A1
#define analog2 A2
#define analog3 A3
#define analog4 A4
#define analog5 A5
// poti
#define poti 5
// amplified input
#define mic 0
// switches
#define switch1 15
#define switch2 16
#define switch3 17
// led outs (same pins than power outs)
#define led1 3
#define led2 5
#define led3 6
// power outs (same pins than led outs)
#define out1 3
#define out2 5
#define out3 6
// motor outs
#define motor1_1 8
#define motor1_2 13
#define motor2_1 11
#define motor2_2 12
// pwms motor
#define pwmMotor1 10
#define pwmMotor2 9
// servo outs
#define servo1 2
#define servo2 4
#define servo3 7

 

Basic example to turn LED on/off

 

/* blinking LED

 *
 * basic example to learn arduino syntax
 *

 * SensorAktor Workshop
 * Lab3 2008
 * Kunsthochschule fuer Medien Koeln
 * Academy of Media Arts Cologne
 * http://interface.khm.de

 * pin mapping SensorAktor Shield
 * import SensorAktor.h to get already defined mapping
 *
 * analog inputs: analog0 = pin0, analog1 = pin1, analog2 = pin2,
 * analog3 = pin3, analog4 = pin4, analog5 = pin5
 * built-in poti: poti = pin5
 * amplified input: mic = pin0
 * switches: switch1 = pin1, switch2 = pin2, switch3 = pin3
 * leds: led1 = pin3, led2 = pin5, led3 = pin6
 * power outs: out1 = pin3, out2 = pin5, out3 = pin6
 * motor outs: motor1_1 = pin8, motor1_2 = pin13, motor2_1 = pin11, motor2_2 = pin12
 * motor pwms: pwmMotor1 = pin10, pwmMotor2 = pin9
 * servo outs: servo1 = pin2, servo2 = pin4, servo3 = pin7

 */

// import sensor aktor library for pin mapping
#include <SensorAktor.h>

// this block is executed one time when programm starts
void setup(){

  // set pin modes
  pinMode(led1,OUTPUT);

}

// this block is executed in a loop after setup is called one time
void loop(){

  // sets LED on
  digitalWrite(led1,HIGH);
  // wait (ms)
  delay(1000);
  // sets LED off
  digitalWrite(led1,LOW);
  // wait (ms)
  delay(1000);

}

 

Files needed

Since Arduino 0015 there are some problems with the old “SensorAktor.h” file.

Use this one instead.

SensorAktor.zip

blinkingled.zip