Hi,
it is winter time and I played a bit with my arduino. I now this is not a very fresh idea however I want to share.
I tried to sync the waving with a mercury switch, and even try to use the duration of an amplitude to control the delay. Of course the writing direction gets switched.
Works ok now, however it could need some more testing, but my arm hurts ![]()

This image is from the "prototype" ;D meaning the sync did not work, it is hard to make a picture when the sync works, this is more for the human eye.
/*
* Wink: POV Display test
*
*/
#include <avr/pgmspace.h>
int dir = 1;
int time = 0;
int atime = 0;
int pos = 0;
int val = 0;
int myPins[] = {
6,7,8,9,10,11,12,13};
// + HALLO +
prog_uchar PROGMEM BitMap[] = {
B00000000,
B00000000,
B00000000,
B00000000,
B00000000,
B00000000,
B00010000,
B00010000,
B01111100,
B00010000,
B00010000,
B11111111,
B00010000,
B00010000,
B11111111,
B00000000,
B11111111,
B00010001,
B00010001,
B11111111,
B00000000,
B11111111,
B10000000,
B10000000,
B10000000,
B00000000,
B11111111,
B10000000,
B10000000,
B10000000,
B00000000,
B11111111,
B10000001,
B10000001,
B11111111,
B00000000,
B00000000,
B00000000,
B00010000,
B00010000,
B01111110,
B00010000,
B00010000,
B00000000,
B00000000,
B00000000,
B00000000,
B00000000,
B00000000,
B00000000,
B00000000
};
int len = sizeof(BitMap);
void setup() // run once, when the sketch starts
{
for (int i=0; i <= 7; i++){
pinMode(myPins[i], OUTPUT); // sets the digital pin as output
}
pinMode(5, INPUT); // RIGHT sets the digital pin as input
pinMode(4, INPUT); // LEFT sets the digital pin as input
pinMode(3, OUTPUT); // sets the digital pin as output
//Serial.begin(9600); // opens serial port, sets data rate to 9600 bps
//Serial.println(sizeof(BitMap),DEC);
}
void setLEDs(prog_uchar pattern)
{
for (byte i=0; i <= 7; i++){
if (pattern & (1<<i)) {
digitalWrite(myPins[i],HIGH);
}
else {
// turn off the LED at location (x,y)
digitalWrite(myPins[i],LOW);
}
}
}
void loop() // run over and over again
{
time++;
if (digitalRead(4)==HIGH and dir==1) // checks mercury switch at port 4
{
dir = -1;
atime = time;
time = 0;
pos=0; //sync to start of waving
}
else if (digitalRead(4)==LOW and dir==-1)
{
dir = 1;
atime = time;
time = 0;
pos=len; //sync to start of waving
}
if (dir==1){
digitalWrite(3,HIGH);
pos = (pos + dir) % len ;
}
else
{
digitalWrite(3,LOW);
pos = (pos + dir);
if (pos<0)
{
pos = len;
}
}
// Try to sync to waving speed
val = atime+analogRead(2); // read the value from the pot
setLEDs(pgm_read_byte_near(&BitMap[pos]));
delayMicroseconds(val); // waits
setLEDs(0);
delayMicroseconds(val); // waits
}
Any suggestions code wise and how to get the ultimative POV effect are welcome.
Carsten