Show Posts
Pages: 1 ... 424 425 [426] 427 428 ... 583
6376  Community / Exhibition / Gallery / Re: Plantduino Greenhouse on: July 02, 2011, 11:50:51 pm
Very nice, I like to see a practical use for this stuff.

I guess you spent so much on the enclosure you couldn't afford a full-size green house smiley

6377  Using Arduino / Programming Questions / Re: Really big resolution on a small input voltage range on: July 02, 2011, 06:58:47 pm
The only way I can see to get 10 bits from your .5v range is to condition the signal with an opamp or two to give an offset and amplification.

Opamps aren't my bag though so I can really offer a circuit. Amplifying is easy, offsets I don't know about.

6378  Using Arduino / Programming Questions / Re: How to extract server/domain from a URL in char[] on: July 02, 2011, 08:53:16 am
I would start by getting any possible "http://" out of the way, something like

string_index = 0;  // assume there's no http://

if (memcmp ( "http://", requestedURL, 7) == 0)
    string_index = 7;

// now we can start with a clean string
// do stuff starting at requestedURL[string_index];

6379  Using Arduino / Programming Questions / Re: sei() and cli() inside interupt service routines on: July 02, 2011, 08:44:27 am
As far as I can tell the cli() does absolutely nothing as interrupts are disabled anyway in the ISR.

The sei() may have an affect in that it allows any pending interrupts to happen before this one has quite finished. However why that would be a good idea escapes me.

6380  Using Arduino / Installation & Troubleshooting / Re: button on digital pin 0 and 1, pin 0 stay's high...? on: July 02, 2011, 08:37:54 am
One difference between the two pins is that 0 is driven high by the FTDI chip (through a resistor) and 1 is not. We need to see a schematic.

But why are you using pins 0 and 1 at all? It's bound to cause you trouble.

Just use two other pins.

6381  Using Arduino / Programming Questions / Re: pin change interrupt on: July 02, 2011, 08:30:03 am
in the interrupt i will call GetKey function
Normally this (the GetKey function) is way too long to be called from an ISR, especially with that delay(10) there.

if(KeyVal == ReadSensor(1))

What does ReadSensor() read from? If it's an analogue input there's a 1 in 1024 chance it will be == KeyVal, meaning that the following code in the if block will probably never be executed.

I would have the ISR and code more like

volatile int sensor_val;

ISR (TMR1_OVL_vect) { // I forget the actual timer vector name but you cannot use a PCINT_vect
   sensor_val = ReadSensor(1);

loop () {
  if (sensor_val > 856) ... etc etc

6382  Using Arduino / Programming Questions / Re: Understanding serial data on: July 02, 2011, 07:02:18 am
strcmp() is for comparing two strings, meaning a NULL-terminated series of chars.

You are trying to compare a byte (ReOn) with a string ("redon") and the compiler doesn't like it.

How on earth this

byte ReOn = 'redon';   
byte ReOff = 'redoff';
byte GrOn = 'greenon';
byte GrOff = 'greenoff';

even compiles I have no idea, but it's not valid code AFAIK.

If you want to use strings then declare them like this

char ReOn[] = "redon";


6383  Using Arduino / Project Guidance / Re: Arduino Relays for Failsafes on: July 02, 2011, 05:43:43 am

Should get you started.

Google something like "microprocessor supervisor"

Also look at circuits for a 555 timer in "monostable" mode (I haven't used a 555 for decades but I think it will hold its output low/high as long as it gets trigger pulses).

Another option is to use an ATtiny85 with your own 5-line program (well maybe 10 lines smiley) to do the same thing.

6384  Using Arduino / Project Guidance / Re: Arduino Relays for Failsafes on: July 02, 2011, 04:13:30 am
if I just came along and smashed the Arduino with a hammer
There are several "supervisor" chips that expect a pulse from the processor and will act if it doesn't appear for a while.

A simple 555 timer can be wired to do the same thing.


6385  Using Arduino / Interfacing w/ Software on the Computer / Re: Another Arduino VB Serial question. on: July 02, 2011, 04:09:09 am
Here's some VS 2008 code I've used before
Public Class Form1
    Dim stop_serial As Boolean = False

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim i As Integer
        Dim last_i As Integer = 255
                i = SerialPort1.ReadByte()
                If i <> last_i Then
                    TextBox1.Text = TextBox1.Text + Str(i) + "  " + Now + vbCrLf
                    last_i = i
                End If
            Catch ex As Exception
            End Try
        Loop While Not stop_serial

    End Sub

    Private Sub Form1_Disposed(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Disposed
        If SerialPort1.IsOpen() Then
        End If

    End Sub

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        SerialPort1.PortName = "Com39"
        SerialPort1.ReadTimeout = 10

    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        stop_serial = True
    End Sub
End Class

The DoEvents allows Button2's click to be read which in turn allows the main loop to exit. Using a timeout also stops the serial call from hanging.

6386  Using Arduino / Programming Questions / Re: Understanding serial data on: July 02, 2011, 03:46:03 am
That screen shot implies to me that the iphone is sending a CRLF after each string, ie "redonCRLF".

Try doing

Serial.println (inbyte, HEX)

to see exactly what is being sent (post the results)

You can use those funcs in an if() statement

if (strcmp (string1, string2) == 0) ... // the strings are equal

Whether or not that's the right way to handle your program is another matter. I'd be inclined to send a single character, say

r = red off
R = red on
g - green off
G = green on

Then your (slightly modified) switch statement will work (all other characters such as CR and LF will be ignored).


6387  Using Arduino / Programming Questions / Re: Understanding serial data on: July 02, 2011, 02:15:57 am
is it possible to compare to an array of bytes
Have a look at the strcmp() and memcmp() functions.

But you can't use them directly in a case statement.

6388  Using Arduino / Microcontrollers / Re: Freetronics Eleven vs Genuine Arduino on: July 01, 2011, 12:43:10 am
I have a Freetronics 2010 and it's just fine. Never done anything it shouldn't and always done what it should smiley

Most of the Arduino boards around are clones, I wouldn't worry about it especially from a well-known supplier (which Freetronics are).
6389  Using Arduino / LEDs and Multiplexing / Re: Shift Registers on: June 25, 2011, 07:05:44 pm
Your DoLED func will output 9 pulses, one for every bit and another for the "Position" bit. Try
void DoLED(){
   digitalWrite(latch, LOW);   
   for(int i = 0; i < 8; i++){             
if (i == Position)                     
  digitalWrite(data, HIGH);
  digitalWrite(data, LOW);

  digitalWrite(clock, HIGH);               
  digitalWrite(clock, LOW);

digitalWrite(latch, HIGH); 



6390  Using Arduino / Displays / Re: 4D LABS μLCD-32PT(SGC) 3.2” Serial LCD Display Module Arduino Library on: June 24, 2011, 02:48:24 am
Lookin' good, I'm still nowhere near using my displays yet but am paying attention smiley

Pages: 1 ... 424 425 [426] 427 428 ... 583