Show Posts
Pages: 1 ... 23 24 [25] 26 27 ... 147
361  Using Arduino / Programming Questions / Re: Print Fails on: April 25, 2014, 09:37:57 am
Post the code that doesn't work.

I do not really understand what you are asking.
362  Using Arduino / Programming Questions / Re: Stray '\' in program error even though i am not using it for comments on: April 25, 2014, 07:28:40 am
Changed a few things.

Code:
void setup(){
Serial.begin(9600);
delay(1);
Serial.println("AT");
delay(1);
Serial.println("AT+CMGF=1");
delay(1);
}
void loop(){
delay(1);
Serial.print("AT+CMGS=");
Serial.print(char(34));
Serial.print("9406686543");
Serial.println(char(34));
delay(1);
Serial.println("This is a sms fromxxx....... just saying hello....");
delay(1);
Serial.println(char(26));
while(1);
}

And got this.
Quote
AT
AT+CMGF=1
AT+CMGS="9406686543"
This is a sms fromxxx....... just saying hello....


Like AWOL mentioned, 34 is a quote,
Code:
Serial.print(char(34));
Serial.print("9406686543");
Serial.println(char(34));

The code above can simply be written as
Code:
Serial.print("\"9406686543\"");
363  Using Arduino / Programming Questions / Re: Changing ISR's return address to a function's memory location? on: April 25, 2014, 07:01:33 am
I can't call my function from the ISR directly as my read_voltage function relies on lower level interrupt priorities such as the Timer compare register match interrupt and ADC conversion complete interrupt to complete it's work.

If you enable interrupts while in that ISR, your timer events will still fire.

I need the loop function to be empty to ensure both devices (voltage and current sampling boards) enter the ISR at the same instant. If the loop function had an 'If statement' set up checking the status of a flag set in the ISR, each device could be a number of machine cycles through the if statement operation before jumping to the ISR and hence would not be simultaneous.

When an interrupt is polled it is called after the current machine cycle finishes, not the entire operation or if statement.
364  Using Arduino / Programming Questions / Re: Iterating over an unsigned char array bit by bit. on: April 25, 2014, 06:48:50 am
My BitBool library makes this easy.

Code:
BitBool< 64, true > buffer ={ B00000000,
                        B00000000,
                        B00101000,
                        B00000000,
                        B00010000,
                        B00000000,
                        B00000000,
                        B00000011
                      };
void setup() {
  Serial.begin( 9600 );
 
  for( char i = 0 ; i < buffer.BitCount ; ++i ){
    Serial.print( buffer[ i ], DEC );
  } 
}

void loop() {}
365  Using Arduino / Programming Questions / Re: Startup function in Bitlash won´t execute if created during compile time. on: April 25, 2014, 04:08:00 am
the function call needs to be inside a function, not at global scope.

To call a function before setup() runs, use a global variable.

Code:
struct SetupBitlash{
  SetupBitlash(){ addBitlashFunction("startup", (bitlash_function) startup); }
};

SetupBitlash sbl;
366  Using Arduino / Programming Questions / Re: Stray '\' in program error even though i am not using it for comments on: April 25, 2014, 04:04:48 am
Code:
Serial.print(34,BYTE);

BYTE is not an option there. Use BIN, DEC, HEX, or for floats, the precision.
367  Using Arduino / Programming Questions / Re: Serial port: To which kind of variable can I assing this SERIAL_8N1?(Solved) on: April 25, 2014, 02:49:39 am
byte is an Arduino specific, include Arduino.h in your lib.

Now, I'm not sure how good this is going to be for your nightmares, however here is a one liner.
I'll check it through again, but it looks ok.

Code:
configuration_UART = ( ( ( bit_parite * 4 ) + ( longueur_donnees == 7 ? 0 : 2 ) + ( bit_arret ? 1 : 0 ) )[ "emgo\x95\x9D\x97\x9F\x85\x8D\x87\x8F" ] ) - 'a';

Questions?  smiley
368  Using Arduino / Programming Questions / Re: Serial port: To wich kind of variable can I assing this SERIAL_8N1?(Solved) on: April 25, 2014, 02:14:38 am
What goes inside the curly brackets, a simple assignment / function call / something complex?
369  Using Arduino / Programming Questions / Re: Serial port: To wich kind of variable can I assing this SERIAL_8E1, SERIAL_8N1? on: April 25, 2014, 01:55:39 am
Wow, cool thank's it will be even eazer then i touth.

No worries.

Quote
but I can't find what it is
For your reference I added a link to the containing file on github.
But you can view the entire core API here ( or your local installation ):https://github.com/arduino/Arduino/blob/ide-1.5.x/hardware/arduino/avr/cores/arduino/
370  Using Arduino / Programming Questions / Re: Serial port: To wich kind of variable can I assing this SERIAL_8E1, SERIAL_8N1? on: April 25, 2014, 01:49:26 am
Just a single byte value:

https://github.com/arduino/Arduino/blob/ide-1.5.x/hardware/arduino/avr/cores/arduino/HardwareSerial.h#L56
Code:
#define SERIAL_5N1 0x00
#define SERIAL_6N1 0x02
#define SERIAL_7N1 0x04
#define SERIAL_8N1 0x06
#define SERIAL_5N2 0x08
#define SERIAL_6N2 0x0A
#define SERIAL_7N2 0x0C
#define SERIAL_8N2 0x0E
#define SERIAL_5E1 0x20
#define SERIAL_6E1 0x22
#define SERIAL_7E1 0x24
#define SERIAL_8E1 0x26
#define SERIAL_5E2 0x28
#define SERIAL_6E2 0x2A
#define SERIAL_7E2 0x2C
#define SERIAL_8E2 0x2E
#define SERIAL_5O1 0x30
#define SERIAL_6O1 0x32
#define SERIAL_7O1 0x34
#define SERIAL_8O1 0x36
#define SERIAL_5O2 0x38
#define SERIAL_6O2 0x3A
#define SERIAL_7O2 0x3C
#define SERIAL_8O2 0x3E
371  Using Arduino / Programming Questions / Re: Logical error in astar on: April 25, 2014, 12:01:00 am
You may have to print a char as a number explicitly, otherwise it may try and print it as an ascii value.

This sketch should illustrate the problem:
Code:
void setup() {
  Serial.begin( 9600 );
  Serial.println( 'a' );
  Serial.println( 'a', DEC );
}

void loop() {}

Quote from: OUTPUT
a
97
372  Using Arduino / Programming Questions / Re: ARRAYS on: April 24, 2014, 09:54:09 pm
Dynamically declaring arrays like you are doing really isn't a good idea.

Why not? Unless persistent data is needed, its a perfectly valid way of allocating an array to the stack.

@OP

You loop variables are backwards and could possibly be writing out of bounds.

Code:
 const int x=createroomRight();
  const int y=createroomStraight();
  int array[x][y];

  for (int i = 0; i < y; i++) {
    int u = 0;
    for (int p = 0; p < x; p++) {
      array[i][p] = 0;

    }
  }

The array is declared [x][y], however you address it like [y][x]
373  Using Arduino / Programming Questions / Re: program execution is not as intended on: April 24, 2014, 07:47:32 am
Code:
if ( checksum == data_checksum )
           {
             Serial.println(" OK");
            
             close();
             delay (10000);
           }

The close() is being called here, when the CRC values match.
Why not remove the call to close if you do not want it to occur there.

If you think that the Arduino is firing off random functions, try again. loop() is called from a loop, so it will repeat, and repeat...
374  Using Arduino / Programming Questions / Re: converting char into integer on: April 23, 2014, 09:26:25 pm
A char cannot contain a floating point value.

You can use a float to do what you ( may ) want.
Code:
float f = 23.5f;
int i = f;

However the decimal portion is dropped and i = 23, not 23.50, or 23.00

Maybe you have a string ( of chars )?
Code:
int i = atoi( "23"  );
//Or
float f = atof( "23.50" );
375  Using Arduino / Displays / Re: Strange bug with myGLCD.drawBitmap when called 6 times on: April 23, 2014, 08:17:38 pm
Quote
As I understand, avr/pgmspace.h is a macro.
It contains macros, among other things. avr/pgmspace.h
Just create a library called farpgmspace and include it where you need it.
Pages: 1 ... 23 24 [25] 26 27 ... 147