Show Posts
Pages: 1 2 [3] 4 5 ... 17
31  Using Arduino / Programming Questions / Re: Is there an easy way to communicate 2 Arduino? on: May 13, 2013, 12:49:18 pm
Did the Serial.print work properly?
Have you tried printing to the lcd on its own?
Break your program down into each individual component and test it. That's how to debug smiley
32  Using Arduino / Programming Questions / Re: New to Arduino - Need advice with a project... on: May 13, 2013, 12:42:44 pm
An HTTP POST request is made up from a set of request headers, and the request body.
Content-Type tells the server the format of the request body, application/x-www-form-urlencoded means the data is a set of name=value pairs serparated by '&' and is the format web browsers send when submitting html forms.
Content-Length tells the server how long the request body is.
The x=hello&y=world is the request body, here I just did an example for sending two parameters, one called x with the value "hello", the second called y with the value "world".
33  Using Arduino / Programming Questions / Re: Is there an easy way to communicate 2 Arduino? on: May 13, 2013, 02:06:13 am
Code:
if(Arduino.available()>1){
    for(i=0; i<3; i++){
      reader[i] = Arduino.read();
      delay(2);
    }
  }
You only check if more than 1 character is available, then try and read 3 characters, just read as many characters as are available.
34  Using Arduino / Programming Questions / Re: New to Arduino - Need advice with a project... on: May 13, 2013, 02:01:55 am
The request should be written as:
Code:
POST /API/Sensor%201/ON HTTP/1.1
Host: 192.168.0.10:8732
Connection: Close
Content-Type: application/x-www-form-urlencoded
Content-Length: 15

x=hello&y=world

35  Using Arduino / Programming Questions / Re: TEA encryption algorithm test vector on: May 12, 2013, 05:16:42 pm
TEA encrypts your data in blocks of 64 bits. The smallest piece of memory you can address is an 8 bit byte, therefore you need to break your data up into blocks of 8 bytes (if it's less than 8 bytes long, or doesn't round to a whole number then you need to pad the data, this is often done with 0s).
What data are you actually trying to encrypt, what I had described was for testing the algorithm with some random data, depending what data you want to send you will want to change it accordingly.
36  Using Arduino / Programming Questions / Re: Why static function on: May 12, 2013, 12:25:29 pm
When a function is declared as static it is only available inside the c file where it is defined.
37  Using Arduino / Programming Questions / Re: Changing Some Functions to Work with ATTiny85 on: May 12, 2013, 08:25:56 am
The map function from the Arduino library (in WMath.c), should work on anything written in c/c++:
Code:
long map(long x, long in_min, long in_max, long out_min, long out_max)
{
  return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
}
38  Using Arduino / Programming Questions / Re: How to interface LISY300 Gyroscope Module with arduino on: May 12, 2013, 05:58:26 am
What module are you actually using. You can get an LISY300 which is just the chip broken out, giving you an analogue output, or you can have something like the link in your original post that uses SPI.
39  Using Arduino / Programming Questions / Re: How to interface LISY300 Gyroscope Module with arduino on: May 11, 2013, 02:41:07 pm
Why are you doing analog read of the sensor?? It communicates with SPI
40  Using Arduino / Programming Questions / Re: Basic include questions on: May 11, 2013, 01:04:47 pm
An annoying little bug with the Arduino IDE seems to be that if you include anything from the standard library into your code files you need the include at the top of both the cpp file and the Arduino sketch file (ino).
41  Using Arduino / Programming Questions / Re: TEA encryption algorithm test vector on: May 11, 2013, 12:54:03 pm
TEA takes in pairs of 32 bit numbers and encrypts them based on a 128 bit key. If you have a stream of bytes, you need to break this down into 64 bit chunks, and then send each chunk as a pair of 32 bit values.
e.g.
Code:
#define DATA_LENGTH 40 //must be a factor of 8 to ensure whole number of 64 bit chunks
unsigned char dataToEncrypt[DATA_LENGTH]; //Fill this up with some random bytes
unsigned long* pData;
unsigned long key[4]={0x12345678,0x90123456,0x78901234,0x56789012}; //Your encryption key, 4*32 bit values=128 bits

pData=(unsigned long*)dataToEncrypt;

for(char n=0; n<DATA_LENGTH/4;n+=2){
   encrypt(pData+n,key);
}
42  Using Arduino / Programming Questions / Re: Using Arduino Leonardo as joystick on: May 11, 2013, 08:25:16 am
Try adding in some Serial.print() for debugging, put it in places such as detecting a button press to make sure you are actually detecting the button press properly. This will help you pinpoint your errors.
43  Using Arduino / Programming Questions / Re: Ultrasonic Sensor/New Ping Library code on: May 11, 2013, 06:31:54 am
Are you talking about this?
Code:
//cm = (int)cm;
  interval1 = map(cm, 30, 300, 20, 800);
  if(cm >0 && cm >30) interval1 = 20;
  if(cm == 0) interval1 = 800;
first you map the range of cm to interval1.
then if cm is greater than 0 and greater than 30 (i.e. greater than 30), set interval1 to 20, even though you just mapped the range for cm>30 to 20-800.

Maybe have a look at constrain().
44  Using Arduino / Project Guidance / Re: Gy-521 accelerometer code on: May 11, 2013, 06:26:31 am
Deja vu, spooky..
Accelerometer (gy-521) to measure velocity and Force
45  Using Arduino / Programming Questions / Re: Using Arduino Leonardo as joystick on: May 11, 2013, 06:08:53 am
Yeah if you're using pull up resistors on your buttons then they will be in an active low configuration (pin pulled low by button being pressed) so all the logic will be inverted.
Pages: 1 2 [3] 4 5 ... 17