Show Posts
Pages: 1 ... 11 12 [13] 14 15 ... 25
181  Using Arduino / Project Guidance / Re: Help: arduino php mysql (electronic toll booth) on: February 01, 2013, 09:41:42 am
Here's a couple of links that may be useful to you. They deal with reading serial ports with PHP. Once you can get PHP to read the data storing it is easy. PHP and mysql get along nicely. Can we assume your server is just a LAMP box?
182  Community / Bar Sport / Re: How do you misuse sticky tape? on: January 31, 2013, 11:56:17 am
I would imagine that taping co-workers to office chairs is misuse.

In the eyes of the people who supply the tape.
183  Using Arduino / Programming Questions / Re: Can't find old topic on clock compensation on: January 29, 2013, 08:57:29 pm
Past couple of days? Have you checked your browser history?
184  Using Arduino / Programming Questions / Re: Greater than but less than statement - PID sketch on: January 26, 2013, 03:21:46 pm
if(gap > .5 && < 1)   // this is incomplete

if(gap > .5 && gap < 1)      // this is probably what you wanted

if (.5 < gap && gap < 1)     // this is how I'd do it only because that shows gap between the two values

You've repeated this little error.
185  Using Arduino / Programming Questions / Re: Crash coarse on pointers and references on: January 25, 2013, 10:11:20 am

One of the better tutorials you'll find. There's a good section on pointers. Great site for language reference as well.
186  Using Arduino / Programming Questions / Re: Button Sequence question on: January 24, 2013, 04:32:58 pm
Think of it this way. You'll have one array that holds the combination and another that will be built from user input. When the user is done with input you can just compare the two arrays and use a flag to see how the comparison went. It's either right or wrong. Right?

byte combination[] = {1, 2, 3, 4, 5};  // a 5 number combination
byte userInput[5]; // same size, will hold user input

// to compare them we'll start with a flag set true
boolean flag = true;

// then a simple for loop can do the check
for (byte n = 0; n < 5 ; n++)
    if (userInput[n] != combination[n]) // any number that doesn't match means a miss
        flag = false;
// at this point flag will be true if it matched and false if it didn't

Does that help?
187  Using Arduino / Programming Questions / Re: Serial communication between two arduino on: January 24, 2013, 01:20:27 pm
188  Community / Bar Sport / Re: Arduino And Quantum Physics on: January 24, 2013, 11:42:25 am
Chuck all your hook up wires and jumper cables into a box and give it a shake? 

No need to shake it. Everyone knows that you can place neatly wound up wires into a box and they'll tangle themselves over time.
189  Using Arduino / Programming Questions / Re: runtime error... memory overload? on: January 23, 2013, 06:26:29 pm
I see a bunch of mixing of types. I also don't see all the code. All variables that I use in calculations involving millis() I declare as unsigned long. Any constants I use in such calculations get UL at the end.

I see some division by 1000 to compare to runFor. If runFor was multiplied by 1000 then this division wouldn't be needed. I'm guessing runFor represents seconds. It would be better to have it represent millis().

That's some stuff I see but I'm just a hack. Some smarter than me guys will no doubt find some other issues.
190  Using Arduino / Programming Questions / Re: Problem writing to SD card on: January 22, 2013, 05:33:02 pm
Have you tried printing out your filenames to the serial monitor to see if it's doing what you want?
191  Using Arduino / Programming Questions / Re: Is it possible to reduce a sketch size be modifying libraries? on: January 22, 2013, 02:11:53 pm
To regain program space on a recent project I dropped the SD card logging as well. Since I had another Arduino around I just turned it, with the SD card shield, into a logger. My project outputs data samples via serial prints and the other Arduino reads them and saves them, to the SD card. It's fairly simple to do.

I also made it so that when you're done logging you can just jumper a pin to ground and it will allow displaying or deleting the file and a few other useful things. Pull the jumper and it's a stand alone data logger.

192  Using Arduino / Programming Questions / Re: converting feet to metres with decimal points on: January 17, 2013, 09:48:49 pm
thanks for the detailed reply, i wish i understood it :/

Maybe it will make sense in the morning.

so if i have a float, all i seem to be doing with the count number is dividing it?

Yes. Each count increments by one. Dividing that by ten gives you feet. Meters = feet / 3.28

and do i convert the "string" to an val? or dec, so lcd.write ("feet,VAL,metre,VAL1); ?

No. Split your lcd.writes See the example in the code block below.

it seems i cant get around the math behind this? or the logic of how n it works,

i know this seems a bit of a pain especially since you gave such a detailed answer  but would you be able to explain it? briefly is fine, I just dont how dividing it so many times yields a conversion?
thankyou smiley

its cool if you cant, it its late to be fair,thanks

// lcd example
// clear the screen and position cursor
lcd.write("Ft ");    // write the first part
lcd.write(feet);     // the variable feet found with count / 10
lcd.write(" M "); 
lcd.write(meters);   // meters = feet / 3.28

Hope it helps.
193  Using Arduino / Programming Questions / Re: converting feet to metres with decimal points on: January 17, 2013, 07:32:10 pm
meters = feet / 3.28

Have you noticed any consistent mathematical relationship as you increment through the values?
194  Using Arduino / Programming Questions / Re: ERROR!!! on: January 16, 2013, 04:48:12 pm
I think that code is going to flicker on the LCD.

Once you do what AWOL suggests and get the code working you'll see what I mean.
195  Using Arduino / Programming Questions / Re: 3-Position Switch on: January 15, 2013, 01:53:54 pm
Out of boredom I wrote your code in a way more like how I'd approach it.

// Some handy macros. So, I have a thing for defines lately OK!
#define   LED_A_PIN               2
#define   LED_B_PIN               3
#define   LED_A_ON                digitalWrite(LED_A_PIN, HIGH)
#define   LED_A_OFF               digitalWrite(LED_A_PIN, LOW)
#define   LED_B_ON                digitalWrite(LED_B_PIN, HIGH)
#define   LED_B_OFF               digitalWrite(LED_B_PIN, LOW)

#define   SWITCH_POSITION_A_PIN   19
#define   SWITCH_POSITION_B_PIN   18

// variables
byte switchState = 0;             // to store switch reading 0 = off 1 = posA 2 = posB
byte lastSwitchState = 0;         // to check for change

void setup() {
  pinMode(LED_A_PIN, OUTPUT);
  pinMode(LED_B_PIN, OUTPUT); 

void loop(){
  // Read the switch and put the result is switchState
  if (READ_SWITCH_POSITION_A == HIGH) switchState = 1;
  if (READ_SWITCH_POSITION_B == HIGH) switchState = 2;
  else switchState = 0;

  // Only do anything if the state has changed
  if (switchState != lastSwitchState){
    lastSwitchState = switchState;
    case 1:
    case 2:
    case 0:     
      Serial.println("Switch Off");

Compiles but not tested for bugs.

A couple of differences, other than reading the pins appropriately is that this code only turns LEDs on or off if the switch state has changed. It also turns the LEDs off when in the off position. It does require that the switch be wired with resistors. You don't need resistors if you use the internal ones.
Pages: 1 ... 11 12 [13] 14 15 ... 25