Show Posts
Pages: 1 [2] 3 4 ... 247
16  Using Arduino / Programming Questions / Re: First program, help on: August 22, 2014, 01:12:49 pm
It seems that your expectation is that you can send your four byte frame with a single call to digitalWrite - you can't. If you are communicating with the pump controller using serial communications, including start & stop bits, you could collect your four bytes in a buffer and send it using a single call to serial.write.

However, if you're really intending to send four bytes of data only, you will need to send it bit by bit down the wire. Multiple calls to digitalWrite will serve you here - see "bit banging".

It would be easier to help if you have documentation that describes the protocol you're trying to use.
17  Using Arduino / Project Guidance / Re: Multicontroller on: August 22, 2014, 06:58:39 am
If you want to do this with an Arduino, I don't think an UNO has enough pins - eight relays, ten LEDs, LCD,  buttons and presumably a RTC will quickly exhaust the eighteen available. If you're doing heating & chilling, I'd assume you have temperature sensors too - any others?

The PIC that BillHo identified has no more RAM/Flash than the Uno and shift registers could be used to solve the pin shortage, but I'd step up to a Mega.  Is that PIC the only processor in the system?

This looks like a lot of work: you'll need to reverse engineer what you have and then build a new sketch, quite likely new circuitry too. I'd be more inclined to debug what you have and fix it using the original design.   
18  Using Arduino / Project Guidance / Re: teaching arduino to high school students? on: August 21, 2014, 07:44:56 am
I assume that you will need to teach at least some of your students to program in C/C++ and some may not have coded at all, so you'll need to allocate time to teach, or at least debug their copy & paste efforts. Some really simple projects may help here to get something working without having to master the nitty gritty of all that is C.

Perhaps a chicken coop example - an LDR to decide night or day and a servo to open/close a (very light) door. Easy to introduce hysteresis here too.

Especially for your first iteration of the class, I'd want the projects to be a bit open ended. The traffic light example above is great for this as more & more complexity can be added. I like a greenhouse controller project for the same reason and indeed the chicken coop can be made more sophisticated too.

More load on the teacher, but it might make things more interesting if you have teams of students work different projects in the second half of the course.
19  Using Arduino / Programming Questions / Re: Can't make button increment my Array :( on: August 21, 2014, 06:24:27 am
It looks like your value array is too small - there is no space for the terminating NULL byte. Your use of sprintf is overflowing.
20  Using Arduino / Programming Questions / Re: Nested IFs - a quick check would be appreciated on: August 20, 2014, 02:59:48 pm
You might consider putting this and its twin in functions of their own:
        if(current_heading>left_limit) // check if left rotation limit is reached
            //<... here the instructions to rotate stepper to the left ...>;
            play_note(1); // cannot move further to the left - buzz!
Then you still have the same functionality, but the nested ifs have gone away (or hidden at least).

You may well find too, that that pair of functions can be refactored so that they simply call a function that does both left and right, depending on what parameters it is passed.
21  Using Arduino / Project Guidance / Re: ARDUIO LOCAL ROUTER NTP SERVER on: August 20, 2014, 10:54:03 am
Is this any use?
22  Using Arduino / Programming Questions / Re: Arduino Xbee flex sensors to servo motor communication problems on: August 20, 2014, 07:52:20 am
Yes. I think the OP assumed that flush would get rid of the line ending, but these days it doesn't.
23  Using Arduino / Programming Questions / Re: Arduino Xbee flex sensors to servo motor communication problems on: August 20, 2014, 07:15:23 am
Try using print instead of println in the sending code. Look up what flush does too - it's likely not what you think. Alternatively, just get rid of it.
24  Using Arduino / Programming Questions / Re: Help with Serial parsing for GUI. on: August 20, 2014, 06:54:59 am
Why are you reading the serial port in the processData function at all? I'd expect that routine to be making decisions based on the data string it was passed; printing it and then ignoring it seems odd.
25  Using Arduino / Programming Questions / Re: set cursor was not declared in this scope on: August 18, 2014, 02:34:40 pm
The compile error may be related to which LiquidCrystal library you are using. Try using a different one.

Doesn't look like it - the first use of setCursor correctly uses an lcd object. The second doesn't.
26  Using Arduino / Programming Questions / Re: set cursor was not declared in this scope on: August 18, 2014, 09:43:21 am
  if (i==0) lcd.setCursor(16,0);
27  Using Arduino / Programming Questions / Re: Where can I learn programming for arduino? on: August 17, 2014, 07:58:55 am
Jeremy Blum's youtube tutorials often come up when this question is asked - disclaimer: have not watched them myself.
28  Using Arduino / Programming Questions / Re: [HELP!] Weird GPS data and micro SD card problem on: August 16, 2014, 06:19:44 am
Your GPSdata function only populates and returns struct A if there is data coming in from the gps. If there wasn't, which will often be the case because serial data transfer is slow, loop will pick up whatever happened to be on the stack and treat it as an instance of GPSstruct. As you see, that stack content is garbage.

You must ensure that GPSdata always returns a valid struct - make the return the very last line of the function. Make struct A global, or better, a static variable in GPSdata.
29  Using Arduino / Project Guidance / Re: Drink Mixer (precise liquid dispensing) on: August 15, 2014, 08:44:05 am
Here's a thread on the same topic

There's a link in there to the drinkmotizer, which does the same job but uses linear actuators to work the optics rather than raising the glass.

Optics seem like a good solution - what's giving you pause there?
30  Using Arduino / Project Guidance / Re: Where do I begin? reading data from Weather Station and display it on: August 14, 2014, 08:36:52 am
Given the size of the data stream and the general paucity of RAM on most arduinos, I'd be inclined to to try parsing it field by field as you receive it. Serial data transmission is slow compared to the Arduino clock speed so you should have plenty of time. Given the age of your weather station, I'd expect the baud rate to be pretty low too.

As you read the serial stream, keep note of which field you're on so you know how big it is and whether you want it. If you do, copy it to a little buffer and call a routine to process it, which will likely consist of a switch statement controlled by field number.

Of course, if your sketch is simple enough, you may do just as well buffering a complete packet but the above method may help when you start adding features and use up your remaining RAM.

Pages: 1 [2] 3 4 ... 247