Recent Posts

Pages: [1] 2 3 ... 10
1
thanks for the reply, I'm really desperate that why I include goto function, even though I remove is the same, that why I need to find a way how to make my void loop become real loop keep on checking the state if milo or nescafe is high. seems like my program just only flow once. if I change the state to low, I have to reset it in order to get that result.
2
Programming Questions / Re: No digitalWrite
Last post by larryd - Today at 04:41 am
Also:

Are the joyfull LEDs set as OUTPUTS?


Always show the whole sketch.



3
Programming Questions / Re: No digitalWrite
Last post by aarg - Today at 04:38 am
You are not just missing something. You're missing a whole list of interrupt do's and don'ts. Go to Nick Gammon's tutorials on interrupts for a good education.
4
Project Guidance / Re: Make my project permanent
Last post by larryd - Today at 04:36 am
I thought that was REV 8 for a minute.  :o



Time to try using wire wrap wire for that kind of stuff.



5
Programming Questions / No digitalWrite
Last post by pntrbl - Today at 04:35 am
I've got this program running just fine into the serial monitor. Now I want to use the results to light some LED's on the output pins.

Code: [Select]
}

void loop() {

  if (millis() - lastmillis >= 60000) { /*Update every minute.*/

    detachInterrupt(0);    //Disable interrupt when calculating


    mph = mphcount / 104;  /* Convert pulsecount to MPH.*/

    Serial.print("MPH =\t"); //print the word "MPH" and tab.
    Serial.print(mph); // print the mph value.
    Serial.print("\t Pulse=\t"); //print the word "Pulse".
    Serial.println(mphcount); /*print pulsecount.*/


   
    if (mph == 50)digitalWrite(7, HIGH);    /*50*/
    else digitalWrite(7, LOW);
    if (mph == 50)digitalWrite(9, HIGH);
    else digitalWrite(9, LOW);

   

    mphcount = 0; // Restart the MPH counter
    lastmillis = millis(); // Uptade lastmillis
    attachInterrupt(0, mph_anemometer, FALLING); //enable interrupt
  }
}


void mph_anemometer() { /* this code will be executed every time the interrupt 0 (pin2) gets low.*/
  mphcount++;
}


General info; Got a 555 oscillator making 5244 pulses a minute, that gets divided by 104, which equals 50mph, and that's what it says on the serial monitor.

But when I try "if (mph == 50)digitalWrite(x,HIGH);", on a couple of outputs to show that result on a pair of LED's, there's no joy.

Seems to me like that should work but I'm obviously missing something ...
6
Project Guidance / Re: Make my project permanent
Last post by larryd - Today at 04:34 am
Quote
I see where it looks like it will plug in to the Arduino, so this is used as a standoff to solder to instead of using the arduino?


The male headers soldered on this shield plug into the female headers on the UNO etc.


7
Sensors / Re: MS554 MS5540-CM
Last post by j4m35 - Today at 04:34 am
That tutorial does the bit shifting backwards (for some reason) for the c1-c6 values. Reverse the bit shifting operators in the lines where the variables c1-c6 are set. You can look at the datasheet for the pressure sensor and it shows where in word1-word4 the c1-c6 values are obtained. If you know about bit shifting, you can see that the code provided in the tutorial has the bit shift operators for that particular part of the code backwards.
Here is what the  tutorial code provides for values c1-c6.
long c1 = word1 << 1;
long c2 = ((word3 & 0x3F) >> 6) | ((word4 & 0x3F));
long c3 = (word4 << 6) ;
long c4 = (word3 << 6);
long c5 = (word2 << 6) | ((word1 & 0x1) >> 10);
long c6 = word2 & 0x3F;

Here is the corrected code
long c1 = word1 >> 1;
long c2 = ((word3 & 0x3F) << 6) | ((word4 & 0x3F));
long c3 = (word4 >> 6) ;
long c4 = (word3 >> 6);
long c5 = (word2 >> 6) | ((word1 & 0x1) << 10);
long c6 = word2 & 0x3F;
8
Project Guidance / Re: Light sensor
Last post by wvmarle - Today at 04:32 am
How do you know the value has stopped increasing?
9
Project Guidance / Re: Make my project permanent
Last post by ChrisTenone - Today at 04:31 am
I have looked at these.  Only question I would have is how to make the connections.  Since the holes are all isolated, it would require some form of bridge between components.  I've seen something like this done in the past with wires wrapped around posts, real old school.
Where there's a will, there's a way:

10
Programming Questions / Re: Erase sketch and libraries...
Last post by aarg - Today at 04:30 am
You should be able to copy flash erase code from the bootloader.
Pages: [1] 2 3 ... 10