Difference between revisions of "Exercising slow"
(4 intermediate revisions by the same user not shown) | |||
Line 10: | Line 10: | ||
nadine platform 15 meters long | nadine platform 15 meters long | ||
− | ==''Code''== | + | |
− | ==''xbee config''== | + | ====''Mirror setup''==== |
+ | ====''Code''==== | ||
+ | Here's the code I used to drive a [http://en.nanotec.com/linearactuators.html linear actuator] hooked up to the [http://en.nanotec.com/downloads/pdf/2899/SMC11_Technisches%20Handbuch_V1-5_en.pdf Nanotec SMC11] stepper driver board. | ||
+ | |||
+ | |||
+ | <syntaxhighlight lang="C"> | ||
+ | |||
+ | /* Code to control the Nanotec SMC11 stepper board from an arduino | ||
+ | */ | ||
+ | |||
+ | int EnPin = 2; // Enable low = active, high = disabled | ||
+ | int DirPin = 3; // Direction low = active, high = disabled | ||
+ | int ClkPin = 9; // CLK | ||
+ | int sensorPin = A0; // select the input pin for the potentiometer | ||
+ | int sensorValue = 0; // variable to store the value coming from the sensor | ||
+ | int CurrPin = 6; // Current enable pin | ||
+ | int incomingByte; | ||
+ | int ctrl = 0; | ||
+ | |||
+ | |||
+ | |||
+ | void setup() | ||
+ | { | ||
+ | pinMode(EnPin, OUTPUT); // sets the pin as output | ||
+ | pinMode(DirPin, OUTPUT); // sets the pin as output | ||
+ | pinMode(ClkPin, OUTPUT); // CLK | ||
+ | digitalWrite(EnPin, LOW); | ||
+ | digitalWrite(DirPin, LOW); | ||
+ | digitalWrite(CurrPin, HIGH); | ||
+ | Serial.begin(9600); | ||
+ | |||
+ | |||
+ | } | ||
+ | |||
+ | void loop() | ||
+ | { | ||
+ | // Serial commands to arduino F = Forward, B = Backwards, S = Stop motor | ||
+ | if (Serial.available() > 0) { | ||
+ | |||
+ | incomingByte = Serial.read(); | ||
+ | if ( incomingByte == 'F'){ | ||
+ | ctrl = 1; | ||
+ | //Serial.print("F"); | ||
+ | } | ||
+ | if ( incomingByte == 'B'){ | ||
+ | ctrl = 2; | ||
+ | //Serial.print("B"); | ||
+ | } | ||
+ | if ( incomingByte == 'S'){ | ||
+ | ctrl = 0; | ||
+ | //Serial.print("S"); | ||
+ | } | ||
+ | } | ||
+ | |||
+ | |||
+ | |||
+ | switch (ctrl) { | ||
+ | case 1: | ||
+ | //do something when var equals 1 | ||
+ | //Serial.print("1"); | ||
+ | forward(); | ||
+ | break; | ||
+ | case 2: | ||
+ | //do something when var equals 2 | ||
+ | //Serial.print("2"); | ||
+ | backwards(); | ||
+ | break; | ||
+ | case 0: | ||
+ | stops(); | ||
+ | } | ||
+ | |||
+ | |||
+ | } | ||
+ | |||
+ | void run() | ||
+ | { | ||
+ | |||
+ | digitalWrite(ClkPin, LOW); //active | ||
+ | delayMicroseconds(200); | ||
+ | digitalWrite(ClkPin, HIGH);//disabled | ||
+ | delayMicroseconds(400); | ||
+ | |||
+ | } | ||
+ | |||
+ | void forward() | ||
+ | { | ||
+ | digitalWrite(EnPin, LOW); | ||
+ | delayMicroseconds(150); | ||
+ | digitalWrite(DirPin, LOW); | ||
+ | delayMicroseconds(150); | ||
+ | run(); | ||
+ | } | ||
+ | |||
+ | void backwards() | ||
+ | { | ||
+ | digitalWrite(EnPin, LOW); | ||
+ | delayMicroseconds(150); | ||
+ | digitalWrite(DirPin, HIGH); | ||
+ | delayMicroseconds(150); | ||
+ | run(); | ||
+ | |||
+ | } | ||
+ | |||
+ | void stops(){ | ||
+ | digitalWrite(EnPin, HIGH); | ||
+ | delayMicroseconds(150); | ||
+ | |||
+ | } | ||
+ | |||
+ | </syntaxhighlight> | ||
+ | |||
+ | ====''xbee config''==== | ||
Using [http://www.moltosenso.com/client/fe/browser.php?pc=/client/fe/download.php moltosenso network manager iron] to configure Xbee modules. | Using [http://www.moltosenso.com/client/fe/browser.php?pc=/client/fe/download.php moltosenso network manager iron] to configure Xbee modules. | ||
Using Xbee Pro series 2 | Using Xbee Pro series 2 |
Revision as of 13:57, 11 January 2013
All questions about motion or speed are only complete with an appropriate frame of reference.
Exercising slow at 50.8357°N & 4.3615°E,
I find myself in between projects, exploring our perception of time in preparation of a new installation.
The last 11 months David De Buyser and I worked together on our projects in a series of residencies.
At NADINE we present our different interests in a collaborate scenography.
Our current state of ideas about sound, light and movement linked in a series of events.
concrete block 19/39/9 cm 8.6 kg
birch platform 25.5 cm
nadine platform 15 meters long
Mirror setup
Code
Here's the code I used to drive a linear actuator hooked up to the Nanotec SMC11 stepper driver board.
/* Code to control the Nanotec SMC11 stepper board from an arduino
*/
int EnPin = 2; // Enable low = active, high = disabled
int DirPin = 3; // Direction low = active, high = disabled
int ClkPin = 9; // CLK
int sensorPin = A0; // select the input pin for the potentiometer
int sensorValue = 0; // variable to store the value coming from the sensor
int CurrPin = 6; // Current enable pin
int incomingByte;
int ctrl = 0;
void setup()
{
pinMode(EnPin, OUTPUT); // sets the pin as output
pinMode(DirPin, OUTPUT); // sets the pin as output
pinMode(ClkPin, OUTPUT); // CLK
digitalWrite(EnPin, LOW);
digitalWrite(DirPin, LOW);
digitalWrite(CurrPin, HIGH);
Serial.begin(9600);
}
void loop()
{
// Serial commands to arduino F = Forward, B = Backwards, S = Stop motor
if (Serial.available() > 0) {
incomingByte = Serial.read();
if ( incomingByte == 'F'){
ctrl = 1;
//Serial.print("F");
}
if ( incomingByte == 'B'){
ctrl = 2;
//Serial.print("B");
}
if ( incomingByte == 'S'){
ctrl = 0;
//Serial.print("S");
}
}
switch (ctrl) {
case 1:
//do something when var equals 1
//Serial.print("1");
forward();
break;
case 2:
//do something when var equals 2
//Serial.print("2");
backwards();
break;
case 0:
stops();
}
}
void run()
{
digitalWrite(ClkPin, LOW); //active
delayMicroseconds(200);
digitalWrite(ClkPin, HIGH);//disabled
delayMicroseconds(400);
}
void forward()
{
digitalWrite(EnPin, LOW);
delayMicroseconds(150);
digitalWrite(DirPin, LOW);
delayMicroseconds(150);
run();
}
void backwards()
{
digitalWrite(EnPin, LOW);
delayMicroseconds(150);
digitalWrite(DirPin, HIGH);
delayMicroseconds(150);
run();
}
void stops(){
digitalWrite(EnPin, HIGH);
delayMicroseconds(150);
}
xbee config
Using moltosenso network manager iron to configure Xbee modules. Using Xbee Pro series 2