Loading...
  Show Posts
Pages: 1 ... 66 67 [68] 69 70 ... 82
1006  Using Arduino / Project Guidance / Re: multiple BlinkWithoutDelays allowed ? on: March 25, 2011, 02:31:55 am
I did and it didnt work :-)

Just wondered if I am doing something forbidden before I try to work out why it isn't working.

If I just asked if multiple BlinkWithoutDelays  is allowed , someone would have said  " post your code "

1007  Using Arduino / Project Guidance / multiple BlinkWithoutDelays allowed ? on: March 25, 2011, 02:08:53 am
I need to use the normal BlinkWithoutDelay procedure for a 1 second countdown, in the usual manner, which is working.

I also need in the same sketch, to be able to sound a hooter for 4 seconds ( "horn" )  or for 2 seconds ( " toot" )

Can I use multiple BlinkWithoutDelays  with separately defined  previous times i.e.
Code:
long previousMillis = 0;        // will store last time  updated
long previoustootMillis = 0;        // will store last time toot was updated
long previoushornMillis = 0;        // will store last time horn was updated
long interval = 1000;           // interval countdowntimer (milliseconds)
long intervaltoot = 2000;           // interval at which to toot (milliseconds)
long intervalhorn = 4000;           // interval to sound horn (milliseconds)



with the countdown timer as :-



Code:
[code]if (T >= 0 && pause == 0 ) {
    unsigned long currentMillis = millis();

    if(currentMillis - previousMillis > interval) {
      // save the last time you counted
      previousMillis = currentMillis;   

      T -- ;
[/code]

and the hooters:-

Code:
if (toot ==1 ) {
   
    horn=1;   // switch on horn
    unsigned long currentMillis = millis();
    if(currentMillis - previoustootMillis > intervaltoot) {
      // save the last time you tooted
      previoustootMillis = currentMillis;   
      horn = 0 ;  // switch off horn after intervaltoot
      toot = 0; // reset toot flag
    }
 }



if ( T <= 0 && pause == 0 ) //counted to 00 and not yet paused
{   
    horn=1;   // switch on horn
    unsigned long currentMillis = millis();
    if(currentMillis - previoushornMillis > intervalhorn) {
      // save the last time sounded horn
      previoushornMillis = currentMillis;   
      horn = 0 ;  // switch off horn after intervaltoot

  pause = 1;   
    }
}

1008  Using Arduino / Project Guidance / Re: formatting data for VirtualWire ? on: March 22, 2011, 02:20:20 am


I have got it sorted thanks  Tx side after defining   char msg [3];


Code:

    msg[0]= address;
    msg[1]= key;
    msg[2] = T;   // seconds remining in countdown

    digitalWrite(ledPin, true);               // turn on Tx supply and LED to show transmitting


    vw_send((uint8_t *)msg, strlen(msg));     // send the character out 

    vw_wait_tx();                             // Wait until the whole message is gone
    delay (50);

     digitalWrite(ledPin, false);              // turn off theTx and  LED


and the Rx side :-


Code:
{
uint8_t buf[VW_MAX_MESSAGE_LEN];
uint8_t buflen = VW_MAX_MESSAGE_LEN;

if (vw_get_message(buf, &buflen)) // Non-blocking
{
 
 Serial.println("Got: ");  // Show on PC for debugging

   Serial.print(" unit ID = ");
    Serial.println(buf[0], DEC);
   
    Serial.print(" key number = ");
     Serial.println(buf[1], DEC);
     
      Serial.print(" seconds remaining = ");
      Serial.println(buf[2], DEC);
     
1009  Using Arduino / Project Guidance / Re: formatting data for VirtualWire ? on: March 21, 2011, 08:13:31 am
OK I found I don't need the on/off, or the pause command as such, I can just transmit the key number, the address number , and the time.

I have got

 msg[0]=key;     
msg [1] = address;                         
 msg[2]=T;       

  vw_send((uint8_t *)msg, strlen(msg));     // send the character out
    vw_wait_tx();                             // Wait until the whole message is gone   

What do I tell the receiver to look for, and how do I separate the data?  The example shows

uint8_t buf[VW_MAX_MESSAGE_LEN];
uint8_t buflen = VW_MAX_MESSAGE_LEN;
if (vw_get_message(buf, &buflen)) // Non-blocking
{


1010  Using Arduino / Project Guidance / Re: formatting data for VirtualWire ? on: March 21, 2011, 06:55:19 am
Thanks Paul I will try that
1011  Using Arduino / Project Guidance / formatting data for VirtualWire ? on: March 21, 2011, 05:35:16 am
I have ( with a load of help from Crossroads and his fencing timer ) got my wireless shotclock timer transmitter working.

But my data is different to what he has, and I am stuck on how to package the data and send it.

I have a timer, counting down from 60 seconds max, and a "pause" signal,  which is sent to 2 remote displays, each with a 2 digit LED display.


The timer side is working fine , the time left "T" is an integer,  and the pause, and on/off signals are either 1 or 0.

I also have a 4 bit address set from dip switches from binary switches
Code:

  add3 = digitalRead(SW3);
  // shift it left 3 places
  add3 = add3 << 3;
  add2 = digitalRead(SW2);
  // shift it left 2 places
  add2 = add2 << 2;
  add1 = digitalRead(SW1);
  // shift it left 1 place
  add1 = add1 << 1;
  add0 = digitalRead(SW0);
  // now OR it together
  address = address|add3;
  address = address|add2;
  address = address|add1;
  address = address|add0;
 Serial.println("my address is: ");
Serial.println(address, BIN);
  msg[1]= address;

When the "preset seconds " on the remote is pressed,  (or when the pause button is pressed ) I want to send the time in seconds "T", and send "pause" as high .

The slave units must then update their countdown to the master one, and pause.

When the "run" button is pressed I want to send the master time in seconds "T", and send "pause" as low .

The slaves will again be reset to the master and carry on the countdown.

I am not sure how the msg[0]  and msg [1] are working,

Can anyone guide me how to send my 6 bits of time "T",   my "pause" bit,  my 4 bit binary address .  and another bit for "on"

I am struggling to see how to make them into a message, that I can separate at the receiver end, which is my next task, at the moment I am just looking at the data from the receiver, I need to know how to set up the VW message receiving .


1012  Using Arduino / Project Guidance / Re: leds. on: March 14, 2011, 01:40:54 pm
But it could never get near that, with both teams on the score of 88, and at 36 min and 36 seconds left in the game, the numbers would have 200 led strips on @ 18mA  =  3.6A

and with team BBBBB  playing against team BBBBB the letters would also have 200  strips on @ 18mA  =  3.6A

so the max current in real life ( for one second while the teams are tying 88 each )  is 7.2 Amps.

Which is less than 58%  of the 150 watts which is perfectly safe.

1013  Using Arduino / Project Guidance / Re: leds. on: March 14, 2011, 10:17:35 am
Hey Crossroads,  thankfully I have some retired people who are happy to solder LEDs all day !!!   ( and they are not in prisons like China ! ) 
1014  Using Arduino / Project Guidance / Re: leds. on: March 14, 2011, 10:12:25 am


But it would not be an overload , 12 * 12.16  =  145.92 watts,

But that would have to be with both teams drawn at 88 points/goals each  at 88minutes and 88 seconds left on the clock :-)  and I am not even going to try and work out what the names of the teams must be to get maximum LEDs on !   smiley-razz
1015  Using Arduino / Project Guidance / Re: leds. on: March 14, 2011, 09:07:54 am
Heres a board I am busy finishing off with 2528 LEDs ( they are red, interestingly,  as in the reflection on the right, not orange as the camera sees full power )


http://www.flickr.com/photos/johnandlyn/5526322956/

If all the LEDs were on ( which cannot happen with the text characters )  it would only draw 12.16 amps from the 12 volt 150 watt power supply I am using.

Some of the LED strings are 5 LEDs in series, and the alpha ones are 4 ( different resistors  balance the brightness )  none are multiplexed,  the LEDs columns are latched on with high power shift registers that cost 5 US cents each  ( thats one of the reasons )
1016  Using Arduino / Networking, Protocols, and Devices / Re: HT12E library on: March 10, 2011, 11:21:52 pm
I have been using the HT12 chips for 20 years now,

 I see you have quite a few  " tries" in the code.

Does it compare the data stream 3 times as the HT12D does?    I am afraid I do not understand some of the code as I am a newbie still.

I have one application where I use 5 of the address lines to step through 32 binary switches ( via  5-32 line decoder ) and the 4 bit data from each switch is sent sequentially.   Its pretty slow but doesn't matter for my application

The other 3 address lines are used for a one of 8 addresses ( security is not an issue in my application )

Would this library be able to be altered to receive these 32 nibbles so that I could decode them for sending to my displays?
1017  Using Arduino / Audio / Re: reading audio files from SD card waveshield on: March 08, 2011, 04:36:24 pm
Thanks Mike,  our local agent who mirrors Farnell only has the TSSOP package, but I might be able to get the SOP package through RS Components who operate here. ( I can solder that one, and the production run is too small to warrant outside assembly )

By the way, I got back to fault finding my faulty unit, and it turned out to be a faulty SD card ( 4 weeks old )

I hope addressing them with only 2 volts data doesn't kill them !   The other 3 units are working fine.

I might change the micro in the audio side of the unit to run from 3v3 to resolve the problem, and use a simple resistor/clamp circuit for the address lines which are very slow.
Thanks again for your time..
1018  Using Arduino / Audio / Re: reading audio files from SD card waveshield on: March 08, 2011, 10:00:25 am
nearly two years lead time from Farnell  !  ,  I think I will play with the resistors, or perhaps a quad op amp.
But thanks for your time
1019  Using Arduino / Audio / Re: reading audio files from SD card waveshield on: March 08, 2011, 01:57:30 am
Thats the one it needs, thanks,  now to see if I can get it in Africa !
1020  Using Arduino / Audio / Re: reading audio files from SD card waveshield on: March 07, 2011, 05:02:30 pm
It will work fine with a 3v3 supply, but the input must be 0 - Vcc and the inputs are 5v from the micro....  perhaps I am missing something here.

 http://www.cl.cam.ac.uk/teaching/2003/DigElec/part2-data.pdf

Pages: 1 ... 66 67 [68] 69 70 ... 82