I am trying to make a Geneva wheel using Arduino.
The hexagon Geneva magnificent mechanism allows a rotating wheel to stop at each of 6 steps on the wheel for a short while and them move to the next one. It can be designed for octagon, pentagon, or anygon..
see this link abot Geneva mechanism
http://en.wikipedia.org/wiki/Geneva_drive
Below is a suggested code for a 4 stops using a sensor on arduino. Can anyone comment if it works ?
suggested code
/*
Conditionals - If statement
This example demonstrates the use of if() statements.
It reads the state of a potentiometer (an analog input) and turns on an LED
only if the LED goes above a certain threshold level. It prints the analog value
regardless of the level.
created 17 Jan 2009
modified 9 Apr 2012
by Tom Igoe
modified 12 Feb 2015 by Robopunk
This example code is in the public domain.
http://arduino.cc/en/Tutorial/IfStatement
*/
// These constants won't change:
const int analogPin = A0; // pin that the IR sensor is attached to
const int MotPin = 9; // pin that Motor driver transistor is attached to
const int threshold = 400; // an arbitrary threshold level that's in the range of the analog input
void setup() {
// initialize the motor pin as an output:
pinMode(MotPin, OUTPUT);
// initialize serial communications:
Serial.begin(9600);
}
void loop() {
// read the value of the IR
int analogValue = analogRead(analogPin);
// if the analog value is high enough, turn on the motor:
if (analogValue > threshold) {
digitalWrite(MotPin, HIGH);
delay(3000);
digitalWrite(MotPin,LOW);
}
else {
digitalWrite(MotPin,LOW);
}
// print the analog value:
Serial.println(analogValue);
delay(1); // delay in between reads for stability
}