Show Posts
Pages: 1 [2] 3 4 ... 113
16  Products / Arduino Due / Re: Arduino DUE on: September 08, 2014, 04:39:37 pm
I haven't used the DUE but here's a few things to watch for.
- one obvious thing is that the pin assignments on the DUE may be different than on the UNO and MEGA.
- you must be careful that the DUE is a 3V3 part and won't tolerate 5V on its pins.
- you will need to use the 1.5.7 version of the IDE for the Due.
- in your code, 'int' on the MEGA and UNO is 16-bits but it is 32-bits on the DUE. This can cause problems with programs.

Pete
17  Using Arduino / Programming Questions / Re: Problems with strcpy on: September 08, 2014, 03:45:32 pm
Code:
    strcpy(pc[0], charBuf);

Here 'pc[0]' is not the address of the first character in the array. It is the content of that character. If there's a linefeed there, then strcpy is trying to copy charBuf to memory starting at address 0x0A.
You should use either
Code:
    strcpy(&pc[0], charBuf);
or
Code:
    strcpy(pc, charBuf);

Pete
18  Using Arduino / Programming Questions / Re: Mysterious "ghost definition" of a user-defined function on: September 08, 2014, 03:34:22 pm
This statement:
Code:
  if (IsDead && DomeOpen)
is a good example of why you should have "verbose output after compilation" set in your preferences.
Then read and understand what the warning messages are telling you. In this case:
Code:
sketch_sep08a.ino: In function 'void loop()':
sketch_sep08a.ino:97:17: warning: the address of 'boolean IsDead()' will always evaluate as 'true' [-Waddress]
'isDead' is the *address* of the boolean function isDead(). In other words, the function isn't being called correctly.

Pete
19  Using Arduino / Programming Questions / Re: Mysterious "ghost definition" of a user-defined function on: September 08, 2014, 02:21:21 pm
One of the problems is that the variables Output and RepCheck are declared globally but then passed to the close function as (incorrectly specified) arguments. Change the declaration of Close to:
Code:
boolean Close(void)
so that Close will use the global variables Output and RepCheck.

You've got several other syntax errors to fix as well. For example, in the Close function you have:
Code:
Serial.write(output);
which presumably should be:
Code:
Serial.write(Output);

There's really no point to having this statement in Close():
Code:
while (Open)
This will work just as well if you remove the declaration of Open and change the while to:
Code:
while (1)

There are others but I'll let you earn some of your paycheque smiley

Pete
20  Using Arduino / Project Guidance / Re: Converting an organ to midi on: September 08, 2014, 10:20:20 am
You might find some info here: http://forum.hauptwerk.com/index.php

Pete
21  Using Arduino / Programming Questions / Re: Serial read pauses program on: September 07, 2014, 06:04:13 pm
The problem is this:
Code:
      byte size = Serial.readBytes(input, INPUT_SIZE);
You are asking readBytes to read 30 characters, which it will try to do. If it doesn't read 30 chars it will timeout after one second because you didn't tell it to do anything different.

If the data being sent end with a linefeed, you would be better off using:
Code:
      byte size = Serial.readBytesUntil(,'\n',input, INPUT_SIZE);
but you must make sure that the line is no more than 30 characters long including the linefeed.

Pete
22  Using Arduino / Programming Questions / Re: Serial.print Output changes the content of an array on: September 06, 2014, 05:13:02 pm
The getMatrixByMode function is returning a pointer to myArray[] which only exists within the getMatrixByMode function. The array needs to be global or at least scoped such that the calling function(s) still sees it.

Pete
23  Using Arduino / Programming Questions / Re: arduino 1.5.7 error java.lang.StackOverflowError at java.util.regex.Pattern$Loo on: September 05, 2014, 05:10:51 pm
I think another thing that can cause it is an unterminated comment
/*

Pete
24  Topics / Science and Measurement / Re: Arduino Timing Conflicts on: September 04, 2014, 10:29:54 pm
Quote
So, to sum this up: there are no problems when t-t' is small, only when t or t' is small.
Yes.

What is it you are trying to solve?

Pete
25  Topics / Science and Measurement / Re: Arduino Timing Conflicts on: September 04, 2014, 06:43:51 pm
No. If t=100 and t'=200 then you will be generating up to 6 characters every 200 microseconds or so depending upon how long the analogRead takes. But if the baudrate is 9600, it will take on the order of 6ms to actually transmit the characters. The buffer is going to fill up and then you'll lose characters.

Pete
26  Using Arduino / Installation & Troubleshooting / Re: Arduino auto restarts itself! on: September 04, 2014, 05:35:53 pm
@filippo94:
I think it would help a lot if you describe exactly what you mean by "autoreboot itself" and what you observe happening at this point.

Pete
27  Using Arduino / Installation & Troubleshooting / Re: Arduino auto restarts itself! on: September 04, 2014, 12:43:36 pm
add
delay(5000);
at the end of the loop() function.
It probably won't fix things altogether but you are reading and displaying the results too fast. Then, show us the output from the serial monitor for the first minute or so. (in code tags - not quote tags)

Pete
28  Using Arduino / Interfacing w/ Software on the Computer / Re: Serial Monitor affected by Serial.Read? on: September 04, 2014, 10:08:33 am
If there's no serial input available you process it as if there was. Try this:
Code:
 if(Serial.available())
   { // If data is available to read,
     val = Serial.read(); // read it and store it in val  
     a++;
      Serial.print("a = ");
      Serial.println(a);
    }

Pete
29  Using Arduino / Microcontrollers / Re: IC PROGRAMMING on: September 03, 2014, 09:07:23 pm
"one time only" and "EEPROM" don't really go together. If it is electrically erasable then it isn't one time only. However, IIRC, early EEPROMs were still referred to as one-time-only because they needed a separate 12V supply to rewrite them which required removing them from the production circuit (usually 5V only) and putting them in a programmer. [edit] Also IIRC, reprogramming them required hooking them up to a PC - usually through the parallel port.

Pete
30  Using Arduino / Microcontrollers / Re: IC PROGRAMMING on: September 03, 2014, 07:39:31 pm
The chip is rewritable but only in the presence of a a programming voltage on the VPP pin while the PGM pin is held low. The programming voltage might be 12V whereas the chip might be readable with 5V. It would have helped if you had identified the chip.

Pete
Pages: 1 [2] 3 4 ... 113