Show Posts
Pages: 1 ... 25 26 [27] 28 29 ... 67
391  Using Arduino / Project Guidance / Re: Webpage controlled robot project. Need help on: February 13, 2013, 07:34:14 pm
Bitlash Commander might be suitable for your application.  It runs on the PC and serves web control panels that talk to the Arduino.

https://github.com/billroy/bitlash-commander


-br
392  Using Arduino / Programming Questions / Re: More efficient data storage method on: February 13, 2013, 08:16:34 am
Perhaps instead of:
Code:
byte myArray[1000][12] =
{
     {                                                 // This is the first of the 1000 indexes
          {1,1,1,1,1,1,1,1,1,1,1,1}     // This takes up 12 bytes, but could be done in 2 bytes
     }
};

…you could represent the table like this:
Code:
int myArray[1000] =
{
          0b111111111111,     // This takes up 2 bytes
          ...
};

This is a simple (but large) text edit of what you've already done.

Next, go read up on bitRead and bitWrite and use them to access the bits of your shiny new integer bit patterns in the table.  Something like this:
Code:
          digitalWrite(leds[3], bitRead(myArray[i], 3);  //... to read the fourth bit

-br

393  Using Arduino / Programming Questions / Re: Please help me with "int function()" ! on: February 12, 2013, 06:46:23 pm
Code:
   input = getKeyboard;

You probably meant to call the function:

Code:
   input = getKeyboard();

-br
394  Using Arduino / General Electronics / Re: The ants come marching in (and release magic smoke) on: February 12, 2013, 08:15:02 am
Perhaps an ant farm shield would make a good organic random number generator project.

-br
395  Using Arduino / Project Guidance / Re: Controlling Arduino from an exernal (nice) webpage on: February 12, 2013, 07:41:14 am
Bitlash Commander might be worth a look for your application.  The code is available on GitHub here: https://github.com/billroy/bitlash-commander

There's a sketch for the Arduino side that comes with Bitlash (http://bitlash.net) called "ethernetcommander.ino".  It knows how to receive and execute Bitlash commands over the 'net, and how to send notifications upstream to the server.  You can customize the sketch for your application.

Then there's the Bitlash Commander server.  It talks to the Arduino over usbserial _or_  the 'net.  The server serves web pages which are control panels whose controls and indicators talk to the Arduino.  There's a graphical editor for the control panels, or you can roll your own in HTML/Javascript.

Commander is a node.js application that uses JSON to communicate with the Arduino and for real-time updates to the web browser content.

Good luck with your project,

-br

Edit: There's a test server (with no Arduino connected) you can play with here: http://bitlash-commander.herokuapp.com


396  Using Arduino / Displays / Re: Clear a specific line on: February 11, 2013, 12:39:49 pm
What does the data sheet say?  Got a link?

-br
397  Using Arduino / Programming Questions / Re: sprintf problem on: February 11, 2013, 08:29:20 am
Krupski, that is a cool feature addition.  If you want it to live forever, get it into the Arduino mainline by packaging up and posting a pull request to the core guys on the Arduino github: https://github.com/arduino/Arduino

-br
398  Using Arduino / General Electronics / Re: Servo Issues on: February 10, 2013, 07:39:44 pm
Have you tried the Servo library examples?

File -> Examples -> Servo

-br
399  Using Arduino / Programming Questions / Re: morse code flasher - lookup table question on: February 10, 2013, 07:18:40 pm
Interesting project.  I use a slightly different approach in the example morse transmitter that ships with Bitlash that may be worth considering. 

In this implementation, the morse data is encoded as a table of bytes, bit-packed.  Three bits of length and five bits of morse data for each character, with a little overflow table for symbols that don't fit.  All in PROGMEM, of course.

Code is here for the taking: https://github.com/billroy/bitlash/blob/master/examples/morse2/morse2.pde

Good luck with your project,

-br
400  Using Arduino / Programming Questions / Re: Newbie Frustration on: February 09, 2013, 05:51:22 am
Code:

if (Serial.available() > 0){
    for (int i=0; i < 5; i++){
       input[i] = Serial.read();

You're reading five bytes when you're only guaranteed to have "more than zero" available.  When you read a byte that isn't there, you get -1 which prints as the y with umlaut.

Perhaps a check for > 5 would work better?


-br
401  Using Arduino / Programming Questions / Re: Simple HTTP POST to Wifi Thermostat. HELP NEEDED on: February 07, 2013, 06:44:26 am
Quote
Also, not sure if this is a factor but when viewing one of the web pages that contains setting info from the browser, it appears to only be returning TEXT. the text on the web pages is as follows:

{"temp":66.00,"tmode":1,"fmode"smiley-mad,"override":1,"hold":1,"t_heat":66.00,"tstate"smiley-mad,"fstate"smiley-mad,"time":{"day":2,"hour":23,"minute":16},"t_type_post"smiley-mad}

This is as expected; it's what a JSON response body looks like.  Your POST body will look similar but simpler since it only contains the one parameter you want to change.

Quote
The link to the api i send in my first post says the data can be added to responses of GET and POST methods.

Yes.  Your POST will consist of three lines:

1. POST /tstat/remote_temp HTTP/1.1
2. A blank line
3. The POST body containing your JSON-encoded parameter data: {"destruct_time":72}

As Paul says, posting your code will get better help.


-br
402  Using Arduino / Programming Questions / Re: Simple HTTP POST to Wifi Thermostat. HELP NEEDED on: February 05, 2013, 05:37:47 pm
Have a look at Section 2.5 of the .pdf at the link.  That section provides examples using the gold-standard "curl" command line http tool.

The thermostat expects the data for the POST command to be in JSON format in the body of the post.  See Section 2.5.2 for a very clear example.

Unfortunately you can't do that from the browser command line for easy testing, but if you have or can get curl on your system you would find it helpful.

In the browser, GET of the various API urls should work fine to see the current settings, and should be your basic "is it up" test.

-br
403  Using Arduino / Networking, Protocols, and Devices / Re: Arduino Network causing severe battery drain on WiFi connected devices. on: February 04, 2013, 06:09:45 pm
The Arduino gets its revenge on all those devices with the fancy power saving.  Denial of service by battery depletion.  Not a novel attack, but possibly a novel vector.

-br
404  Using Arduino / Programming Questions / Re: Averaging Digital input. on: February 04, 2013, 05:26:15 pm
Another simple filter for a isolated spikes is to require a data value change to be presented for two or three readings before believing it.

"Tell me once, tell me twice; what you tell me three times I believe is true."

(Edit: You could say this is a way to implement Arrch's proposal.)

-br
405  Using Arduino / Programming Questions / Re: Meddling with the runtime clock on: February 04, 2013, 03:15:31 pm
I use code like this in the Bitlash rollover example (https://github.com/billroy/bitlash/blob/master/examples/rollover/rollover.ino):

Code:
extern volatile unsigned long timer0_millis;

void setMillis(unsigned long newtime) {
uint8_t oldSREG = SREG;
cli();
timer0_millis = newtime;
SREG = oldSREG;
})

-br
Pages: 1 ... 25 26 [27] 28 29 ... 67