|
1036
|
Using Arduino / Project Guidance / Re: Arduino with shift registers to control 70 devices.
|
on: January 30, 2011, 08:23:22 pm
|
|
You could have a el cheapo dual 556 timer chip at each camera, with one 10mS delay, and one 100ms, both triggered from the previous chips falling edge of the 10ms timer - one 50 cent chip, 4 capacitors, and 3 resistors.
You would just need a 3 core cable between each camera ( ground, 5v, and trigger )
Of course you could have an Arduino to tell it when to fire ( keeping with the forum )
|
|
|
|
|
1037
|
Community / Website and Forum / Re: Karma
|
on: January 29, 2011, 09:39:00 am
|
|
shouldn't it be that the only one who can vote Karma, is the original poster posing the question ? it will tell if he/she was helped?
Or is that how it works?
|
|
|
|
|
1040
|
Community / Bar Sport / thanks all for helping with my ( out of my depth ) project !
|
on: January 27, 2011, 06:20:07 am
|
Thanks to all you guys that helped me getting my video/audio announcer going at last. I have battled the last couple of weeks with getting queued numbers to play in the right order, it would drop some numbers, and sometimes announce one number while displaying the next. Early on I had a prototype that didn't queue, and the SD card reader and WaveHC library was working fine, even though I can not understand half the instructions used. I had another look at the sample sketch that I had copied to load and play from the SD card, and found void playfile(char *name) { // see if the wave object is currently doing something if (wave.isplaying) {// already playing something, so stop it! // wave.stop(); // stop it Duh,  I wish I had seen that a while ago ! Not exactly cryptic is it :-) With it commented out, everything is running wonderfully, it will faithfully display and announce up to 10 messages in the queue. I love my Arduino again  Thanks guys
|
|
|
|
|
1044
|
Forum 2005-2010 (read only) / Bugs & Suggestions / saving files logicaly?
|
on: November 18, 2010, 06:08:34 am
|
|
I dont understand how the save feature works, with other design type software I usually open the last version I was working on, then save it as a new name ( usually with the date ) and then carry on working. I know then that I can always go back to yesterdays work irrespective of autosave. With Arduino I end up with folders with the new name pde file, which is blank, and the orig pde file ??? If I try to just save, it tells me some things are read only so I must pick a new name and so on..
I have done a search but can find no explanation of how it works, any pointers anyone?
|
|
|
|
|
1045
|
Forum 2005-2010 (read only) / Syntax & Programs / Re: almost there with my vga overlay
|
on: January 19, 2011, 12:46:00 am
|
|
Thanks, I have heard about direct port access, and had a quick look. I am still a newbie and feeling my way round the normal arduino type simple stuff.
This project I am on is actually rather complicated for a beginner but a client saw my prototype and is pushing me for a working model, so I have to get this going asap.
Once I have that out I can rewrite the software at my leisure, if I don't get sidetracked by another project.............
|
|
|
|
|
1047
|
Forum 2005-2010 (read only) / Syntax & Programs / Re: almost there with my vga overlay
|
on: January 18, 2011, 03:41:50 am
|
|
At the moment I am using the ISR to receive and queue subsequent commands while the announcement is playing and showing.
Then when the audio track is finished, I want to check if there is anything in the queue,
The main loop has to refresh the video shift registers ( its a 1280 x 720 HD display I am syncing to ) and doesn't like too much extra work, or I lose sync...
But perhaps I will try looking for the vt input during the bottom half of the screen, where there is no video, and I have a spare 8 milliseconds to decode and queue it....
|
|
|
|
|
1048
|
Forum 2005-2010 (read only) / Syntax & Programs / Re: almost there with my vga overlay
|
on: January 17, 2011, 05:08:41 pm
|
I have just tested the basic queue and dequeue functions in this little sketch and it works fine, so I don't know where my problem lies..... unless I have to add some delay perhaps in the dequeue? #include <FIFO.h> int door; FIFO<int,10> fifo; //store 10 ints ///////////////////////////////////////////////////////// void setup () { Serial.begin(9600); for( door= 9; door >5; door-- ) { fifo.enqueue(door); } } /////////////////////////////////////////////////////// void loop () { if (fifo.count () > 0 ) // sees if there are any unread numbers in queue subroutine { Serial.println ( "and now for the countdown" ); door = fifo.dequeue(); // returns first unread number in queue { Serial.println ( door ); // print current door number delay (200); } } if (fifo.count () == 0 ) { delay ( 5000 ); // waits 5 seconds and adds some more into queue door = 7; fifo.enqueue (door); door = 9; fifo.enqueue (door); door = 2; fifo.enqueue (door); } }
|
|
|
|
|
1049
|
Forum 2005-2010 (read only) / Syntax & Programs / almost there with my vga overlay
|
on: January 17, 2011, 10:57:21 am
|
Thanks for everyones help last year, I have got my vga overlay thing sort of working, but still have some trouble with the queueing of the announcements/displays. I have tried to simplify my pseudo program. My setup is :- I have a Holtek HT12 encoder/ RF link /decoder to send a door number from 1 to 9. The VT ( valid transmission ) output from the decoder is my interrupt input that has a routine to decode the BCD data to decimal 1-9, and put that number in a queue. This is done with the one "video" micro, that also handle the display with a SPI library. There is a second "audio" micro that handles the announcements using WaveHC.h library and a SD card. Once the announcement starts, it runs to the end of the track, and I use the "isplaying" signal to display the door number on the screen for that time. The code below works, ( I have taken out or greyed most of the video side which is working fine ) its just the queueing again that I have a problem with. It will play the track, but keeps repeating it, wherever I put the vtoutPin LOW to reset it. Any ideas?? ( obviously with all the bits chopped out the curley braces will be wrong ) /* VGA overlay generator */ #include <FIFO.h> #include <SPI.h>
volatile int bcda ; // define bcd digital inputs from HT12 volatile int bcdb; volatile int bcdc; volatile int bcdd; // the VT valid transmission from the HT12 connects to pin4 to interrupt on RISING
volatile int door; // door number to show and announce
int talking; // LOW while audio running
/*int vb; // part of display routine int q = B11100000; //part of display routine */ int aPin = A3; //binary data in from Holtek chip, representing door numbers 1 to 9 int bPin = A2; int cPin = A1; int dPin = A0; /*int timingPin = 4; // part of display routine int windowPin = 6; // part of display routine */ int runningPin = 12; // input from audio board, low when audio playing
int aoutPin = 10; // queued bcd codes to audio board int boutPin = 8; int coutPin = 7; int doutPin = 9; int vtoutPin = 3; // vt trigger to audio board to start playing, audio board will play selected track from a SD card, //and hold "running pin" LOW until track is finished.
FIFO<int,10> fifo; //store 10 ints
///////////////////////////////////////////////////////// void setup () {
pinMode (aoutPin, OUTPUT ); pinMode (boutPin, OUTPUT ); pinMode (coutPin, OUTPUT ); pinMode (doutPin, OUTPUT ); pinMode (vtoutPin, OUTPUT ); pinMode (runningPin, INPUT ); pinMode(aPin, INPUT); pinMode(bPin, INPUT); pinMode(cPin, INPUT); pinMode(dPin, INPUT); // pinMode(timingPin, INPUT); //pinMode(fsPin, INPUT); //pinMode(windowPin, OUTPUT ); attachInterrupt(0, queue, RISING); // interupt routine from vt input ht12 to load new number to queue
} //////////////////////////////////////////////////
void loop () { int talking = digitalRead (runningPin ); // checks to see if audio is playing ( will be LOW if it is ) if (talking == HIGH) { if (fifo.count () > 0 ) // sees if there are any unread numbers in queue subroutine { door = fifo.dequeue(); // returns first unread number in queue
if (door == 1){ digitalWrite ( aoutPin, HIGH); // Sends the door number in bcd to the audio micro - // I havnt got round to shortening this bit yet ! digitalWrite ( boutPin, LOW); digitalWrite ( coutPin, LOW); digitalWrite ( doutPin, LOW); }
// and so on for doors 1 to 8
if (door == 9){ digitalWrite ( aoutPin, HIGH); digitalWrite ( boutPin, LOW); digitalWrite ( coutPin, LOW); digitalWrite ( doutPin, HIGH); }
} digitalWrite ( vtoutPin, HIGH); // to audio board to begin announcement }
///////////////////////////////////////////////////////////////////////////////////////////
// all this is display routine /* case 16: SPI.transfer(h); SPI.transfer(q); break; } break;
} */ /////////////////////////////////////////////////////////////////////////////////////////// digitalWrite ( vtoutPin, LOW); // resets the trigger to the audio micro, which goes on announcing for several seconds
}
void queue () { bcda = digitalRead ( aPin ); // check the state of the HT12 data outputs bcdb = digitalRead ( bPin ); bcdc = digitalRead ( cPin ); bcdd = digitalRead ( dPin );
if (bcda==1 && bcdb==0 && bcdc == 0 && bcdd == 0 ) { door = 1; } // and so on for doors 1 - 9 if (bcda==1 && bcdb==0 && bcdc == 0 && bcdd == 1 ) { door = 9; } fifo.enqueue(door); }
|
|
|
|
|
1050
|
Forum 2005-2010 (read only) / Syntax & Programs / Re: simulated sports hooter / horn
|
on: December 12, 2010, 04:57:50 am
|
It works just as above. and it only takes up 1470 bytes so I can fit it in with the existing micro. ( and I found out what I was doing wrong with arrays at last ! ) The only SPI output I am using is the data, I have put a 2k2 resistor from pin 11 to the amplifier input, with a .22 mFD cap to ground from the the amp input. this is the waveform from pin 11 red,, and after smoothing to the amp, green http://www.flickr.com/photos/johnandlyn/5253303071/sizes/z/in/photostream/It gives a dirty brown note full of distortion and harmonics, like a horn. Now I am going to try a siren, seeing as I have plenty of memory to play with.... int latchPin = 8; int clockPin = 12; int dataPin = 11; long int timer;
void setup() { pinMode(latchPin, OUTPUT); pinMode(clockPin, OUTPUT); pinMode(dataPin, OUTPUT); digitalWrite(latchPin, LOW);
}
void loop() {
int noise[] = { B10111001, B01010000, B10111110, B00011110, B00001100, B11011011, B01000111, B00101110, B00010111, B10000011, B10001000, B11110100, B11100110, B01000011, B11111000, B01110000, B01110011, B01011100, B00011101, B10011000, B11101010, B01000110, B00100111, B11000111, B10100001, B00011111, B11000001, B11001100, B01110110, B00111000, B11111010, B00011000, B00100111, B10000100, B01111011, B00011111, B00000111, B00110011, B11111001, B10001100, B01100110, B11110000, B01111100, B10011110, B00010011, B10011100, B01101100, B00111100, B11001111, B00000111, B11000110, B00110010, // theres some spare lines here for messing with the note };
for (timer = 0; timer<800;timer ++) { // gives approx 4 second burst with just this loop playing and a 16MHz xtal.
for (int j = 0; j < 25; j++) { // vary the 25 to change the note
shiftOut(dataPin, clockPin, MSBFIRST, noise[j]); } } delay(1000); // a break between toots ! digitalWrite(latchPin, HIGH); }
|
|
|
|
|