Show Posts
Pages: 1 ... 33 34 [35] 36 37 ... 87
511  Using Arduino / Microcontrollers / Re: "virgin Atmega328PU" to "chip in ArduinoUNO REV3" with only Arduino? on: March 13, 2013, 11:53:13 am
Are you selling those?
Nope. But that is what I bought, at my local RS webstore. Already replaced one. Careless with a 24V wire that briefly touched the chip...
512  Using Arduino / Programming Questions / Re: Button to start an array on: March 13, 2013, 11:50:21 am
The "start array" and "stop array" make no sense. Remove the lines, When you push the button the LEDs will light up and down, once.
Code:
    // start array:   
    digitalWrite(ledPins[thisPin], HIGH);
...
else {
    // stop array:
    digitalWrite(ledPin, LOW);
  }
If you want the running lights to run until the button is pushed again the code needs quite some rearranging.

Pardon the question - but what does the professor know or teach you as it clearly isnt programming?
513  Using Arduino / Microcontrollers / Re: "virgin Atmega328PU" to "chip in ArduinoUNO REV3" with only Arduino? on: March 13, 2013, 11:40:02 am
You can buy a spare chip with the "standard" Arduino boot loader on it.
514  Using Arduino / Programming Questions / Re: Converting sensor text output to a number on: March 10, 2013, 04:10:58 pm
Easy enough smiley-wink No need to buffer anything (or worse; buffering into String ) Assuming you know how to handle the serial port, in your loop do:
() If initialise flag is true, zero  your 3 number variables Y, P and R. Note that we need to do "Y". Rest all countrs /flags.
() Read the next byte until you get past the #YPR (basically anything that is a letter or '=' is discarded)
() When you get a valid digit, put it into the appropiate Y P or R variable, first multiplying previous content by 10. Basically this converts ASCII to int, one char at a time, as they arrive. .
() If you see a decimal point start counting in a seperate variable. Everytime you add a digit in above step, count one if we started counting. If you see a "-" just note this in another boolean variable
() When you see a "," or "\n" the number is done. Move on the next in the Y P R pointer. When done all 3, you're done!

Draw backs - the code will not fail if the number is badly formatted (like two decimal poins) but return some (unpredictable) result. I have used above algorithm in my "nnnC" function published as a post (Search for "nnnC"), yours just needs to do 3 numbers.

515  Using Arduino / Project Guidance / Re: Interfacing with Phidget USB accelerometer on: March 08, 2013, 06:14:22 pm
Not really. It has a USB slave interface so it must go to a USB master like a pc.
There is no clue what the protocol is like (ie which charaters it send/receives)
No circuit schamtics so it can be hacked...
516  Using Arduino / Project Guidance / Re: Reading Continuous Serial Packets on: March 08, 2013, 05:27:30 pm
Quote
Are you saying that I should do a serial available prior to each read.
YES.

Execpt it means that with your loop it will then fall through (as all the available() test will be false for 10ms after the first read) and so you will be back at athe beginning of your loop() and look for the start character....

A "quick" fix (not pretty, has it's own problems) is to do
Code:
if ( Serial.available()>=9 )
at the top. Ie you wait until you have all 9 characters. (The AB and 7 bytes.)
This will break - horribly - if you miss one byte or the sending protocol sends more (like a Carraige return)
517  Using Arduino / Motors, Mechanics, and Power / Re: DC Motor and Potentiometer positioning on: March 08, 2013, 03:57:47 pm
That is what I suggested. But take it in small steps. First write a program that calls your motor left/right code if the analogRead() is above/below a fixed value.

Search this forum for "nnnC" - it is a small function I wrote to send decimal values and a command letter using Serial. Good for quick debugging code/prototypes.
518  Using Arduino / Motors, Mechanics, and Power / Re: DC Motor and Potentiometer positioning on: March 08, 2013, 03:32:07 pm
Quote
then motor turn left or right till my value is true
You need to be specific here. Which value? What makes the value "true"? (In C, anything that is not zero is "true" - but you mean something else here, I think)

In fact, the more specific and very clear you are, the easier it is to write the program. In fact that is how you write a program. You start of with a vauge idea. Then write a few sentences describing it in more detail. Then change each of those sentences into several with more excruciating detail. And again. And then suddenly you have written it in so small steps, that it is trivial to translate to C.
519  Using Arduino / Project Guidance / Re: Reading Continuous Serial Packets on: March 08, 2013, 02:48:56 pm
Thank you Erdin. Yes, we do not know at this moment if the problem is HW or SW.  smiley-confuse

Here is a "correct" way to read serial to do some processing.
Code:
void setup() {
  Serial.begin(9600) ;
}
boolean WaitA = true ;
void loop() {
  if ( Serial.available()>0 ) {
    char C = Serial.read() ;
    if ( WaitA ) {  // If we are waiting for the A
      WaitA = C!='A' ;  // See if it has arrived
         // and then do no more. Execute loop many times until next char arrives
    } else {        // We have recieved a character AFTER the A
      Serial.println(C,DEC) ;  // Printout the decimal value
      WaitA = true ;     // ignore all else until the next A
    }
  }
}
just use your I2C send routine instead. (with write, not print).

The logic here is flawed, if an "A" is part of the data packet - but it is a short example.
520  Using Arduino / Project Guidance / Re: Reading Continuous Serial Packets on: March 08, 2013, 02:35:24 pm
(Answer to your first post) In short: You want to transfer the 7 bytes received on the standard Serial port (after an 'A') on the board designated Master, and then copy them to each of 7 boards, using the I2C, one byte to each. Your current setup is only one slave but it is not echoing the correct characters.

After having sent the one byte to slave1, do you wait for the initiator sequence again (Or at least read and discard 6 characters)? Your description gives reason to believe you send all bytes to the slave.

(As I wrote your 2nd post arrived). The Serial is a straight FIFO (FirstInFirstOut). Thus having read the first byte Serial.read() your next Serial.read() will read the next character. BUT if you keep doing Serial.read() you will be reading before the bytes have arrived, so do not do Serial.read() without checking Serial.available()>0 Your 2nd post makes me believe you incorrectly read Serial.
521  Using Arduino / Motors, Mechanics, and Power / Re: DC Motor and Potentiometer positioning on: March 08, 2013, 01:24:33 pm
Which bit of the program do you need help with? I can understand your test program.

What is the next step? I think to ask the motor to turn until a specific value is reached on the potentiometer. Initially hardcode the targetvalue in the program, making it dynamic from the serial port (or other source) comes later.

To avoid damaging you potentiometer, you can manually turn the potentiometer and see the motor move or not. Mechanically couple the two together when everything works.

In loop(), when not doing serial (ie when available()==0) check the pot value. If it is less than targetvalue call motorturn one direction. If it is more than targetvalue call motor turn other way.

Check that when you manually turn the knob you can make the motor tun one or other way.

The targetvalue test has to include a dead band, ie the test should be less than magicvalue-5 or greater then targetvalue+5

522  Using Arduino / General Electronics / Re: How to measure chip (or other component) temperature? on: March 08, 2013, 01:12:29 pm
whats die temp, is that the core of the ic?
Yes
523  Using Arduino / General Electronics / Re: Need help with 9 servos. on: March 08, 2013, 10:50:23 am
I wont rant about the poor search system on this site, but just point you to a post where a long time ago I helped someone else with this problem - lots of servos.

http://arduino.cc/forum/index.php/topic,59530.msg430572.html#msg430572
524  Community / Bar Sport / Re: Solving the problem of reading values on smd resistors on: March 07, 2013, 04:58:00 pm
so suddenly from the K9 chassis, the CRT would weaken after 3 years, like everyone elses, no more circuit/schematc in the back cover, no helpful access for repairing.
Ahhh - conspiracy theory ....

Except it seems painfully true. Total lack of spare parts for ANYTHING. The economy is booming, people have something to use their earned money on - the enviroment is suffering.

I agree:
Old farts bar talk,  who's round is it anyway ?
Oh... I can take then next one. Just enjoyed a slightly out-of-date Christmas beer (full strength, large bottle)
525  Community / Bar Sport / Re: Youtube bar jokes series: on: March 07, 2013, 04:49:37 pm
You have to be a U.S. ham radio operator is get it,
You have to be a database admin/developer to get it:
A table walks in a bar and sees another table : "Mind if I join you?"
Pages: 1 ... 33 34 [35] 36 37 ... 87