Show Posts
Pages: 1 ... 51 52 [53] 54 55 ... 88
781  Using Arduino / Programming Questions / Re: quick question on: April 04, 2012, 03:27:56 pm
Everything up to the loop() looks good. (You need to change the "val" declaration to two declarations to match this code)
void loop(){
  fan1val = digitalRead(fan1);   // read input value and store it in val
  fan2val = digitalRead(fan2);   // read input value and store it in val
  if (fan1val == LOW && fan2val == LOW) {               // check if both inputs show fan OK (Switch is pressed)
    digitalWrite(greenled, HIGH);   // turn green on
    digitalWrite(redled, LOW);   //  .. and red off
  } else {   // we do not need to test the opposite -  we do not light green, we light red
    digitalWrite(greenled, LOW);    // turn green
    digitalWrite(redled, HIGH  // .. and red on
Normally I do not like writing the code - I like giving a hint, but you wrote "having a mental block" and I can sympasise with that. The leap from "one" to "two" is sometimes hard.

Now if your switch/fan monitoring has a 3rd state, then you need to do "if then else if else" construction - or three seperate if statements. There are pro&con to
782  Using Arduino / Motors, Mechanics, and Power / Re: Newbie help on controlling speed and direction of a dc motor using H-bridge L293 on: April 04, 2012, 08:12:50 am
The "enable" is on pin 9, which is PWM as the article says. Try analogWrite(9,127) or analogWrite(9,20) :-)
783  Using Arduino / Programming Questions / Re: How to Serial.print in Putty? on: April 03, 2012, 03:24:30 pm
That should work if the USB cable is connected, the Putty is set to the Serial port that the USB driver creates, and at 9600 baud.
784  Using Arduino / Programming Questions / Re: Time Interrupts on: April 03, 2012, 11:29:44 am
The code you outline does not need an interrupt - you can simply wait until the threshold is reached.

Is there some "timeout" that is not included in your outline? That, too, can be done without interrupts, by checking time (millis) while you are waiting for the threshold.

Otherwise - a more detailed outline
785  Using Arduino / Programming Questions / Re: Moving servo and read ultrasonic at the same time on: April 03, 2012, 11:26:08 am
Serial.print etc one the earlier Arduino 022 will BLOCK. That is, the program will not continue until the last character is sent.
On the Arduino 1.0 all serial outputs put in a buffer and the interrupts will empty the output buffer as fast as possible. Thus a simple Seril.print or two will not block, but if you fill the buffer (64 characters) faster then it can empty, then the Serial.print will BLOCK for a while.

You can partially test if this is happening for you by increasing or decreasing the baud rate.
786  Using Arduino / Programming Questions / Re: Programming with Time Library on: April 03, 2012, 11:15:20 am
The RTC (real Time Clock) chips I have used, had a small amount of memory (50 bytes or so) that you can use to keep some critical values across power breaks. It is kept valid by the same battery that the clock uses.
787  Community / Website and Forum / Re: Moderation Guidelines && Applications for Moderators on: April 03, 2012, 11:06:55 am
"Be careful for what you wish for, it may become true" smiley
Congrats Nick! So now there is representation on the southern hemisphere and more timezones smiley
788  Using Arduino / Project Guidance / Re: advice needed on reading the data displayed on a 7-segment into arduino mega on: April 02, 2012, 11:05:14 am
OK, I'll give a few "thoughts". Partly because I was pondering a similar problem in "reading" a bathroom digital scales.

Two digits... if it is real 7seg LEDs we have 14 wires we simply couple to 14 Arduino pins. The high impedance of the input should make it safe enough. But the voltage drop across the LED is only a volt or so, so you need some level shift circuit (single transistor amplifying circuit). Not my area of expertise.

If the LEDs are driven by some simple steady state signal, then it is real easy with the program. Just make a lookup table of the 10 different combinations that are valid digits, scan for a match, the offset in the table is the digit value.

No, I suspect the real problem is that the segments are probably driven by some multiplexing circuit, so that the program and electronics need to monitor the state of the common line (whether Common Anode or Cathode) and when it is "on" for that digit, then sample the other lines. There may be challenges with the timing. Could be solved with an ISR.

But definitely doable, I think. Worth the trouble? Maybe, because it will take a few days.
789  Community / Bar Sport / Re: Raspberry Pi launch farce on: March 31, 2012, 01:55:36 am
The danish division of RS is sending me almost weekly letters explaining that "Real Soon Now", "dispatching in order received", "will contact you when ..."

yadadadada ...

That's fine by me, I have no overriding need for the device at this moment.
790  International / Scandinavia / Re: octopus ice stick heat pump on: March 28, 2012, 01:59:20 pm
Hvis det er tænd/sluk af 220V og det er noget der forgår langsomt (ikke oftere end et par gange i minuttet) vil jeg personligt foretrække relæer. Fuld isolation mellem 220 og lavspænding. Styre strømmen til et relæ klares med en enkel MOSFET, darlington eller bare en transistor afhængigt af spolen.
791  Community / Bar Sport / Re: Your latest purchase on: March 11, 2012, 11:39:23 am
Found this CRC 808 valve (picture attached) at a flea market. The seller immediatly suggested 5 (DKK) as a price, and at that level I may buy stuff just because I think it looks pretty. He had 3, I bought all.

Now, what to do with it?
(a) Decorative use if I ever make some Steampunk device
(b) Actually use it as an amplifier (I am thinking of driving LEDs, 3 is just right for RGB)
(c) "Mod" it. I was tinking of somehow sawing off the bottom, and somehow attach LEDs inside.
(d) Resell on the web, as some people might pay real money

They will probably just lie somewhere accumulating dust.
792  Community / Bar Sport / Re: Raspberry Pi launch farce on: March 11, 2012, 11:28:27 am
I have only been allowed to "register an interest" at my local RS Website. That's fine by me, I have no overriding need for the device at this moment.
793  International / Scandinavia / Re: Mitt første program vil ikke kjøre - hva er feil? on: March 06, 2012, 12:46:52 pm
"bootloaderen" - det er stykke program der ligger permament på din chip. Når der kommer strøm på din Artmel chip starter den altid dette program. Dette laver et-eller-andet for at spørge på USB porten om der er en komputer der vil overføre et nyt program. Hvis der ingen komputer svarer indenfor rimlig kort tid, så hopper det program videre til starten af dit program.

Bootloaderen er lidt forskellig fra chip til chip. Det er ikke noget Atmel har lavet, men Arduino folkene, og lagt ned på din ATmel chip (og hvordan det gøres kan vi snakke om en anden gang). Gennem årene har de forbedret denne bootloader og du kunne - hvis nødvendigt - skifte den. Hvis USB porten er helt fri har jeg lagt mærke til at mit program starter straks. Men hvis der er noget så går der en-to sekunder inden den opgiver.

Som en del af denne "snak med komputeren" blinker den med LEDen der er bygget ind på pin13. Det er i tilfælde af at noget ikke virker så kan man se at bootloaderen "har forsøgt".

Jeg tror, hvis du ikke har noget i USB porten (så skal du putte 5v på VIN pinden, eller mindst 7V på Power-stikket) så skulle bootloaderen ikke blinke... men det afhænger af hvilken bootloader du har på din.

Hermed er vi kommet til "the Excutive Summary" på dit spørgsmål: Nej.
794  Using Arduino / Programming Questions / Re: Help accurately measuring motor speed on: March 02, 2012, 04:18:43 pm
I prefer Inc(rotations) ; - ooops - wrong language smiley-wink

(hint - code has to finish with a full stop as the last character)
795  Using Arduino / Programming Questions / Re: Millis() Timing goes way off over time. on: March 02, 2012, 04:09:38 pm
    while(millis()-previousMillis[i]<=on){   //While current time (millis()) minus Previous time is less than ON TIME
digitalWrite(relayPin[i],HIGH);  //Turn ON the relay(array)}
This while loop blocks until the current minus the start time is greater than the on time desired. If that isn't the EXACT same thing delay does, I'll eat my hat.
Remember to post it on YouTube! smiley

delay(on) ;  // wait time on,
digitalWrite(pin,HIGH);  // then turn on pin
digitalWrite(pin,HIGH);  // Turn on pin
delay(on) ;  // then wait timeon,
while(millis()-previousMillis[i]<=on) // whilst waiting time on
digitalWrite(pin,HIGH); ;  // keep (repeatedly) turning pin on

OK, I am splitting hairs here - thought it was worth a shot for the hat eating smiley
Pages: 1 ... 51 52 [53] 54 55 ... 88