Show Posts
Pages: 1 ... 3 4 [5] 6 7 ... 121
61  Using Arduino / Project Guidance / Re: Help! on: April 01, 2014, 08:26:02 am
Yeah, wow, take a deep breath and analyze the complexities here. PaulS is pointing out very valid but only a handful of possibly countless situations you need to handle.

Break down your task ( learn C++ ), prepare for a long haul, there is more than just learning to program C++ required to complete a  project like this. To analyze a busy street you will need multiple tasks running simultaneously with complex signal processing, not to mention everything else. Keep this as a project for when you have enough mileage in the required range of skills.
62  Using Arduino / Project Guidance / Re: Signed integers over i2c - new try. Not working. on: April 01, 2014, 07:48:59 am
That one is easy.

Binary for -25345
Code:
1001 1100 1111 1111

Binary for -100
Code:
1111 1111 1001 1100
63  Using Arduino / Programming Questions / Re: Problem about convert array of string to char using toCharArray on: March 31, 2014, 10:06:01 pm
If you are using the String library you can use standard array logic to access the pointer rather than toCharArray which copies the entire array.

Code:
void setup() {
  String data = "123.456";
  char * carray = &data[ 0 ];
  float f = atof( carray  );
  Serial.begin( 9600 );
  Serial.print( f, 5 );
}

void loop() {}

The alternative using toCharArray works like this: ( carray must be an array, or pointer to valid data )
Code:
void setup() {
  String data = "123.456";
  
  char carray[ 10 ];
  
  data.toCharArray( carray, 10 );
  
  float f = atof( carray  );
  Serial.begin( 9600 );
  Serial.print( f, 5 );
}

void loop() {}
64  Using Arduino / Project Guidance / Re: Signed integers over i2c - new try. Not working. on: March 31, 2014, 09:45:51 am
What are you expecting, and what are you getting instead?
65  Using Arduino / Programming Questions / Re: #if in compilation for use or arduino UNO and ATMEGA 328 or LILY with ATTINY 85 on: March 31, 2014, 06:37:10 am
This may help answer why: http://arduino.land/FAQ/content/2/12/en/why-do-#ifdef-macro_s-stop-the-sketch-from-compiling.html

Also this may help your board selection. ( replace CHIPSET macro with whatever you like ).
Code:
// 168 and 328 Arduinos
#if defined(__AVR_ATmega168__) ||defined(__AVR_ATmega168P__) ||defined(__AVR_ATmega328P__)
#define CHIPSET ATmega_168_168P_328P

// Mega 1280 & 2560
#elif defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
#define CHIPSET ATmega_1280_2560

// Sanguino
#elif defined(__AVR_ATmega644__) || defined(__AVR_ATmega644P__) || defined(__AVR_ATmega1284P__)
#define CHIPSET ATmega_644_644P_1284P

#elif defined(__AVR_ATmega32U4__)

// Teensy 2.0
#ifdef CORE_TEENSY
#define CHIPSET ATmega_32U4_A

// Teensy
#else
#define CHIPSET ATmega_32U4_B
#endif

// Teensy++ 1.0 & 2.0
#elif defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB1286__)
#define CHIPSET AT90USB_646_1286
#endif
66  Using Arduino / Programming Questions / Re: PHP Serial Communication NOT working on: March 30, 2014, 06:38:03 am
You could delve into the IDE source and find what it does to reset the Arduino.

Or maybe put your Arduino into a loop until you receive  a certain string from the PHP script.
Your PHP can connect and send the string with each retry separated by a delay.
Once the communication is finished the Arduino can continue looking for the connect string.
67  Using Arduino / Programming Questions / Re: PHP Serial Communication NOT working on: March 30, 2014, 05:51:17 am
Are you running a local/web server with an Arduino connected, or via a Yun, what is your setup?
68  Development / Other Software Development / Re: Initial setup routine ( Run once code ). on: March 29, 2014, 10:08:51 pm
How about trying to get the Arduino team to fixing the original problem? The Arduino build does not include the EEMEM section and therefore the initialization of the EEMEM varables are not available. Cheers!

It does work if you use an ISP, but EEMEM can be used like I have in the IDE to simply locate a variable there. I think the option of making the eeprom persistent was a good choice for beginners. However a toggle to enable write on upload would be good.

Also my code gives you the advantage of being able to initialize things other than the eeprom.
69  Development / Other Software Development / Re: Initial setup routine ( Run once code ). on: March 29, 2014, 10:35:45 am
Quote
I don't understand pointing to before the start of the array just so you can use prefix notation. Point to the right place and use postfix notation...
would make way more sense (to me) as.. <code>

Even though it looks nice, it doesn't work.

It has to be prefix notation, postfix notation and starting from 0 will fail. The increment must happen after the nested loop, or in my case, at the start which is more efficient.

I agree that it is easier to read shorter sentences...
70  Using Arduino / Programming Questions / Re: Serial.begin and source code HardwareSerial::begin on: March 29, 2014, 05:20:21 am
In the source file all the registers are set for the Serial variables.

Code: (hardwareserial.cpp)
#if defined(UBRRH) && defined(UBRRL)
  HardwareSerial Serial(&rx_buffer, &tx_buffer, &UBRRH, &UBRRL, &UCSRA, &UCSRB, &UCSRC, &UDR, RXEN, TXEN, RXCIE, UDRIE, U2X);
#elif defined(UBRR0H) && defined(UBRR0L)
  HardwareSerial Serial(&rx_buffer, &tx_buffer, &UBRR0H, &UBRR0L, &UCSR0A, &UCSR0B, &UCSR0C, &UDR0, RXEN0, TXEN0, RXCIE0, UDRIE0, U2X0);
#elif defined(USBCON)
  // do nothing - Serial object and buffers are initialized in CDC code
#else
  #error no serial port defined  (port 0)
#endif

#if defined(UBRR1H)
  HardwareSerial Serial1(&rx_buffer1, &tx_buffer1, &UBRR1H, &UBRR1L, &UCSR1A, &UCSR1B, &UCSR1C, &UDR1, RXEN1, TXEN1, RXCIE1, UDRIE1, U2X1);
#endif
#if defined(UBRR2H)
  HardwareSerial Serial2(&rx_buffer2, &tx_buffer2, &UBRR2H, &UBRR2L, &UCSR2A, &UCSR2B, &UCSR2C, &UDR2, RXEN2, TXEN2, RXCIE2, UDRIE2, U2X2);
#endif
#if defined(UBRR3H)
  HardwareSerial Serial3(&rx_buffer3, &tx_buffer3, &UBRR3H, &UBRR3L, &UCSR3A, &UCSR3B, &UCSR3C, &UDR3, RXEN3, TXEN3, RXCIE3, UDRIE3, U2X3);
#endif
71  Using Arduino / Programming Questions / Re: Serial.begin and source code HardwareSerial::begin on: March 29, 2014, 05:19:05 am
You mean Serial, Serial1, Serial2?

Code: (hardwareserial.h)
#if defined(UBRRH) || defined(UBRR0H)
  extern HardwareSerial Serial;
#elif defined(USBCON)
  #include "USBAPI.h"
//  extern HardwareSerial Serial_; 
#endif
#if defined(UBRR1H)
  extern HardwareSerial Serial1;
#endif
#if defined(UBRR2H)
  extern HardwareSerial Serial2;
#endif
#if defined(UBRR3H)
  extern HardwareSerial Serial3;
#endif
72  Using Arduino / Programming Questions / Re: Help with syntax, please! Workaround for Struct issue. on: March 29, 2014, 03:58:44 am
You can also use the struct but remember that a struct is always called by its full name. So if you defined the struct as in the comments at the top of your code, you have to use it as "struct dateTime" and not just "dateTime".

Take note that Arduino uses C++, what you mention is only a C requirement, not C++ which only requires struct on the declaration, and there is only one rare circumstance where it is required elsewhere.

@OP, I have a few articles on the subject here which may provide more insight to Arduino's modifications.
http://arduino.land/FAQ/content/1/3/en/what-does-the-ide-change-in-my-sketch.html
http://arduino.land/FAQ/content/2/13/en/my-class_reference-won_t-work-in-the-sketch.html
http://arduino.land/FAQ/content/2/12/en/why-do-#ifdef-macro's-stop-the-sketch-from-compiling.html
73  Using Arduino / Programming Questions / Re: array like pointer on the function for get the lenth of array. on: March 29, 2014, 03:48:17 am
If you have time for a little read, here is an FAQ I wrote on the topic. http://arduino.land/FAQ/content/1/3/en/what-does-the-ide-change-in-my-sketch.html

At the bottom of the page is a link to another FAQ explaining why your code does not work.
74  Using Arduino / Programming Questions / Re: Iso C++ forbids comparison between pointer and interger on: March 28, 2014, 10:01:43 am
yup, you just said that in the thread earlier.
75  Using Arduino / Programming Questions / Re: Passing object as param on: March 28, 2014, 09:57:41 am
Do you Serial.begin?
Pages: 1 ... 3 4 [5] 6 7 ... 121