Show Posts
Pages: 1 ... 1182 1183 [1184] 1185 1186 ... 1748
17746  Using Arduino / Programming Questions / Re: coding problem... need help.. on: August 17, 2011, 01:38:00 am
Quote
can i remove a 1V bias by puting a 4V in to the AnaLog REF?
No, you simply reduce the range from 0...5V to 0...4V, so 4V now reads 1023 instead of 5V reading 1023.
You could remove the bias by subtracting 1023/5 from each reading.
17747  Using Arduino / Programming Questions / Re: Only Execute Once on: August 16, 2011, 04:44:35 pm
Code:
val = digitalRead(inPin);
    if (val == HIGH)
    {
      digitalWrite(green, LOW);
      digitalWrite(amber, HIGH);                //amber LED on
      digitalWrite(relayPin, HIGH);
      if ( 0 == shutDownTime)                 // <<< changed
        shutDownTime = relay_on_time + 30000; // <<< changed
    }
    if (val == LOW)
If "val" isn't HIGH as a result of a digitalRead, it is unlikely to be anything other than LOW, so retesting it is a bit of a waste of time.
A simple "else" would suffice
17748  Community / Website and Forum / Re: The moral responsibility in giving help? on: August 16, 2011, 03:33:52 pm
Quote
Sometime I blame GB for most of whats wrong in the world
I blame the Romans.
How can you have blame culture without culture?
17749  Community / Website and Forum / Re: The moral responsibility in giving help? on: August 16, 2011, 03:25:24 pm
I'm with Mike on this - whenever I see posts like "I want to modify my anti-lock brakes/mains-powered water heater/rocket roller skates", I usually reply "could you tell me where you live, please, so I'll know where to avoid and possibly where to send the flowers"

There have been several cases in the UK recently of people who thought that robbing copper from an unattended electricity sub-station was a route to easy riches.
Now, even my teenage son recognised that this was akin to stealing a petrol pump with an acetylene torch.
These poor sods are on an intellectual level with the benighted souls in Nigeria who steal products from pipelines, and seem to be regularly killed in droves in doing so.
As a child, it was instilled in to me by my family that you don't mess with electricity, or any energy storage or transmission system.
This simple education seems not to be available to many, despite the middle-class health-and-safety culture (or possibly, simply because of it!)
How far are we from people cutting down distribution pylons for scrap steel?

Unfortunately now, for us, even the relatively uneducated can type stuff into Google.

(I should add, that like many of my generation as a teenager, I was no angel, and my activities with simple garden chemicals (now unavailable), and inflammable substances would now lead now, to someone of my age then, to an ASBO at best, or detention at worst. However, I did take considerable care, and would have been horrified if anything higher than invertibrates had been damaged by my experiments)



Quote
the Nobel Prize was essentially created as an apology to the planet for creating TNT
That would be dynamite, surely?
17750  Using Arduino / Programming Questions / Re: Better Coding Technique? on: August 16, 2011, 02:33:41 pm
You could combine the button states into an integer.
So, button C is bit 0, button Z is bit 1 etc.
If you're not sure about bit manipulation, use "bitWrite"
17751  Using Arduino / Programming Questions / Re: Better Coding Technique? on: August 16, 2011, 02:21:41 pm
Code:
if (chuck.cPressed()) {
    lcd.print("C");
  }
  else if (chuck.zPressed()) {
The "else" implies that cPressed and zPressed are mutually exclusive, but you have told us that they are not:
Code:
if (chuck.cPressed()) {
    lcd.print("C");
}
if (chuck.zPressed()) {
    lcd.print("Z");
}
17752  Using Arduino / Project Guidance / Re: Ultrasonic parking sensor on: August 16, 2011, 02:15:16 pm
Quote
this sensor has only two wires,
Isn't that just a bare transducer?

Why not buy a Devantech or a Ping?
If you're having to ask these questions, you're probably not going to be able to build a working solution from scratch.
17753  Using Arduino / General Electronics / Re: Possible solutions for reducing current load on: August 16, 2011, 02:10:31 pm
Quote
'load'
sp. "gain"
17754  Using Arduino / Project Guidance / Re: Decoding phase shifted signal in 198kHz LW radio carrier on: August 16, 2011, 02:08:41 pm
It should be a pretty reliable service - it is said that if the UK Trident fleet cannot receive Radio 4 on 198 long wave for three consecutive days, they are to follow their orders.   smiley-sad
17755  Using Arduino / Programming Questions / Re: millis help needed on: August 16, 2011, 01:16:19 pm
Quote
but that is ok for the random led it is the time on that does not make sense
No, it isn't alright.

"millis" just returns the number of milliseconds since the Arduino last reset - think of it like a telephone speaking clock service.
17756  Using Arduino / Programming Questions / Re: scrolling colors with two buttons up and down (RGB LED) HELP on: August 16, 2011, 01:13:59 pm
If you press ctrl-t in the IDE,it will auto-format for you.
17757  Using Arduino / Programming Questions / Re: scrolling colors with two buttons up and down (RGB LED) HELP on: August 16, 2011, 12:29:20 pm
No.
Code:
void loop()
{
 btnStateUp = digitalRead(4);
if((btnStateUp == HIGH) && (lastBtnStateUp == LOW)) // Switch is pressed and was not
   btnPressCount++;                                 // Count this press
   btnPressCount = btnPressCount % 7;               // Keep count in the range 0 to 6

Here, it looks like "btnPressCount = btnPressCount % 7;" is conditional, when it isn't (but could be)
17758  Using Arduino / Programming Questions / Re: millis help needed on: August 16, 2011, 12:15:27 pm
Code:
if (ran == 1) {
digitalWrite (led1, HIGH);        //turn this led on when random 1
                        digitalWrite (led2, LOW);       //make sure all others are off
digitalWrite (led3, LOW);      //make sure all others are off
digitalWrite (led4, LOW);      //make sure all others are off
                        if(currentMillis - previousMillis > time4) // has 4.5 seconds gone
                        digitalWrite (led1, LOW);     // so turn it off then read random again
Think what happens if next time through "loop", your program picks a new value of "ran".

(can you sort out your indentation, please, it hurts my eyes)
17759  Using Arduino / Programming Questions / Re: LED blink once then fade once and repeat. on: August 16, 2011, 12:04:55 pm
http://arduino.cc/en/Reference/For
17760  Using Arduino / Project Guidance / Re: PWM input and feedback from potentiometer input, please help on: August 16, 2011, 11:51:31 am
True.
I'm not sure I'd want to wire a 10 ohm pot across 5V though.
Pages: 1 ... 1182 1183 [1184] 1185 1186 ... 1748