Show Posts
Pages: 1 2 [3] 4 5 ... 152
31  Using Arduino / Programming Questions / Re: Interrupts using analog pins on: April 07, 2014, 02:46:32 am
Probably a better idea to use a timer interrupt that fires every x milliseconds and read/store the analogue pin value for main code to pickup and react on.
Another way that is probably not suitable for your needs is to use the build in analogue comparator (Good tutorial here) that would trigger an interrupt when a certain voltage level (distance) is reached.
32  Community / Bar Sport / Re: OSH Park Teensy 3.1 for $17! on: April 05, 2014, 12:04:02 pm
Looks remarkably like the real thing, and the same price.
33  Using Arduino / Programming Questions / Re: Problems with ATEM tally light code on: April 05, 2014, 11:31:48 am
You must be doing something wrong.
I just downloaded the libraries (ATEM, MCP23017 & SkaarhojGPIO2x8) from github, extracted to relevant libraries folder and renamed them and it compiles without error for an UNO/MEGA.
34  Community / Website and Forum / Re: Disable notification fails for me on: April 05, 2014, 04:03:00 am
The only way I have found of a thread I had commented in not showing up in Unread Replies is to delete my posts in that thread. Not ideal if people have responded to my comments as it breaks the chain but rather that than me getting twaddle when the thread has degenerated into off topic or hijacked.
35  Using Arduino / Project Guidance / Re: Automated Kitchen Garden Project on: April 05, 2014, 03:55:55 am
As suspected the alarms fail to fire because the time was not set before they were defined.
You had put a processSyncMessage() in setup but unless you could time the mouseclick to send the time before the routine was called it would still not set the time and fall through to setting the alarms. I just put a while around the processSyncMessage() call so it would sit there until the time was set and then continue. This worked fine for me as you can see from processing output.

Code:
#include <TimeAlarms.h>

#include <Time.h>


#define TIME_MSG_LEN  11   // time sync consists of a HEADER followed by ten
// ascii digits
#define TIME_HEADER  'T'   // Header tag for serial time sync message
const int Pin=22;

void setup()  {
  Serial.begin(38400);
  Serial.println("Waiting for time sync message");
  pinMode (Pin,OUTPUT);
  while(timeStatus() != timeSet){
    processSyncMessage();
  }
  Serial.println("Synced");
  Alarm.alarmRepeat(9,55,0,OnAlarm);
  Alarm.alarmRepeat(9,56,0,OffAlarm);
}

void loop(){
 
  if(Serial.available() )
  {
    processSyncMessage();
  }
  if(timeStatus()!= timeNotSet)
  {
    // here if the time has been set
    digitalClockDisplay();
  }
  Alarm.delay(0);
 
}

void digitalClockDisplay(){
  // digital clock display of the time
  Serial.print(hour());
  printDigits(minute());
  printDigits(second());
  Serial.print(" ");
  Serial.print(day());
  Serial.print(" ");
  Serial.print(month());
  Serial.print(" ");
  Serial.print(year());
  Serial.println();
  delay(1000);
}

void printDigits(int digits){
  // utility function for digital clock display: prints preceding colon
  // and leading 0
  Serial.print(":");
  if(digits < 10)
  Serial.print('0');
  Serial.print(digits);
}
void OnAlarm(){
  digitalWrite (Pin ,HIGH);
  Serial.println("XXXXXX ALARM ON XXXXXX");
}
void OffAlarm(){
  digitalWrite (Pin, LOW);
  Serial.println("XXXXXX ALARM OFF XXXXXX");
}
void processSyncMessage() {
  // if time sync available from serial port, update time and return true
  // time message consists of a header and ten ascii digits
  while(Serial.available() >=  TIME_MSG_LEN ){ 
    char c = Serial.read() ;
    Serial.print(c);
    if( c == TIME_HEADER ) {
      time_t pctime = 0;
      for(int i=0; i < TIME_MSG_LEN -1; i++){
        c = Serial.read();
        if( isDigit(c)) {
          pctime = (10 * pctime) + (c - '0') ; // convert digits to a number
        }
      }
      setTime(pctime);   // Sync clock to the time received on serial port
    }
  }
}


Quote
9:54:55 5 4 2014
9:54:56 5 4 2014
9:54:57 5 4 2014
9:54:58 5 4 2014
9:54:59 5 4 2014
XXXXXX ALARM ON XXXXXX
9:55:00 5 4 2014
9:55:01 5 4 2014
9:55:02 5 4 2014
9:55:03 5 4 2014
9:55:04 5 4 2014
9:55:05 5 4 2014
9:55:06 5 4 2014
9:55:07 5 4 2014
9:55:08 5 4 2014
9:55:09 5 4 2014
9:55:10 5 4 2014
9:55:11 5 4 2014
9:55:12 5 4 2014
9:55:13 5 4 2014
9:55:14 5 4 2014
9:55:15 5 4 2014
9:55:16 5 4 2014
9:55:17 5 4 2014
9:55:18 5 4 2014
9:55:19 5 4 2014
9:55:20 5 4 2014
9:55:21 5 4 2014
9:55:22 5 4 2014
9:55:23 5 4 2014
9:55:24 5 4 2014
9:55:25 5 4 2014
9:55:26 5 4 2014
9:55:27 5 4 2014
9:55:28 5 4 2014
9:55:29 5 4 2014
9:55:30 5 4 2014
9:55:31 5 4 2014
9:55:32 5 4 2014
9:55:33 5 4 2014
9:55:34 5 4 2014
9:55:35 5 4 2014
9:55:36 5 4 2014
9:55:37 5 4 2014
9:55:38 5 4 2014
9:55:39 5 4 2014
9:55:40 5 4 2014
9:55:41 5 4 2014
9:55:42 5 4 2014
9:55:43 5 4 2014
9:55:44 5 4 2014
9:55:45 5 4 2014
9:55:46 5 4 2014
9:55:47 5 4 2014
9:55:48 5 4 2014
9:55:49 5 4 2014
9:55:50 5 4 2014
9:55:51 5 4 2014
9:55:52 5 4 2014
9:55:53 5 4 2014
9:55:54 5 4 2014
9:55:55 5 4 2014
9:55:56 5 4 2014
9:55:57 5 4 2014
9:55:58 5 4 2014
9:55:59 5 4 2014
XXXXXX ALARM OFF XXXXXX
9:56:00 5 4 2014
9:56:01 5 4 2014
9:56:02 5 4 2014
9:56:03 5 4 2014
36  Using Arduino / Networking, Protocols, and Devices / Re: Deciphering SPI commands given to RF module of RC heli on: April 04, 2014, 08:32:44 am
Have you tried different data modes and bit orders?
I would assume that as the arduino is a slave that it does not also need the clock divider setting.
37  Using Arduino / Project Guidance / Re: need help with judge dredd lawgiver lights and sound on: April 04, 2014, 03:20:30 am
That's great thanks Riva. So are pins connectors on the board what you solder the parts to?
Solder, or plug wires into if you use a pin header like an UNO,MEGA have.
 Also can you explain the leds through resistor?
The resistor is to limit the current so the Arduino pin does not get damaged.
https://www.sparkfun.com/tutorials/219
38  Using Arduino / Project Guidance / Re: need help with judge dredd lawgiver lights and sound on: April 03, 2014, 07:37:50 am
LED's should be simple. Just 5 (or 10) arduino pins driving them directly through a resistor. You need to specify what size/power and colour(s) they need to be.
For the sounds something like this will need a couple of pins to control. You will also need a small speaker.
Switch could be as simple as using a single pin.

You could easily do this with an Arduino pro mini or other similar small form factor MCU.
Don't forget power for the kit. You will need some form of battery but the size available in the lawgiver will determine stuff like this.
39  Community / Gigs and Collaborations / Re: Need help programming a photocell/relay shield on: April 03, 2014, 02:04:24 am
What part of the code do I change again that would adjust the time if I want to?
Code:
#define relayDelay 20UL           // Relay delay time in seconds
To ensure the maths work properly keep the UL on the end of the number or you could change the line to
Code:
const unsigned long relayDelay = 20          // Relay delay time in seconds
to make it a bit simpler.
40  Using Arduino / Project Guidance / Re: UART communication between Arduino and Openpicus Flyport on: April 03, 2014, 01:59:32 am
After the false lead with the wrong device the only relevant info I could find on UART is this. You may have a lot more reading and testing to do though to get it working but the basic info seem to be on that page.
41  Using Arduino / Project Guidance / Re: UART communication between Arduino and Openpicus Flyport on: April 02, 2014, 11:05:20 am
A very quick look at the schematic and it does not look like UART is broken out to the header pins.
EDIT:
Ignore above, wrong product.
42  Community / Bar Sport / Re: Time to get designing. on: April 02, 2014, 11:00:04 am
Any idea when this competition ends?
The details are in the T&C but quoted below...
Quote
Atmel Corporation’s Simply AVR Design Contest begins March 31, 2014, and ends September 30, 2014, at 11:59 pm Pacific Standard Time. By submitting an entry, each entrant agrees to the rules of the Contest and represents that he or she is 18 years old or older.
43  Community / Bar Sport / Re: FAQ versus FP(A) on: April 02, 2014, 10:57:30 am
I think one of the reason is that the default setting is not to be mailed when answer come to your post.
I have seen more than one occasion where people were surprised at the many responses when they came back for something else.
First port of call for me after logging in is the 'Unread Replies' link.
44  Using Arduino / Project Guidance / Re: Larger 7 segment with MAX7219 on: April 02, 2014, 10:55:33 am
Next silly question then. Have you tested the segment pinout, maybe they have sent the wrong version. If the answer is you have tested it then it's time to describe pin for pin how it's wired to the MAX7219 and post the code (or sample code) cut down to minimum that works with old segment but not with new.
45  Using Arduino / Project Guidance / Re: Assigning many I2C addresses to an Arduino on: April 02, 2014, 10:46:02 am
Could you maybe get software I2C slave code and tweak it to respond to multiple addresses?
Pages: 1 2 [3] 4 5 ... 152