Go Down

Topic: Bwa ha ha ! Frankenboard lives! (Read 1 time) previous topic - next topic

Jan 21, 2013, 03:33 am Last Edit: Jan 21, 2013, 09:08 pm by Robofarmer Reason: 1
Using Arduino IDE and the tutorials from Adafruit and Sparkfun, I've cobbled together a chip to program. I have been using the "upload using programmer" command and then hunting down the cpp.hex in the temp folder, and then uploading via Avrdude. So far though, the blinking and fading led sketches are the only ones that have worked.  Is there a big difference in the way you would write code for an Arduino and a standalone? Or maybe the way the IDE compiles for Arduino vs. what you would want for a standalone?
For example the sweep and knob sketches result in the servo rotating clockwise continuously no matter what changes I make to the code.

Would really appreciate any suggestions. Also if any one wants links to the resources I've used so far I can post those links.

Edit: Frankenboard is a more accurate description

CrossRoads

Maybe not so much "Frankenchip" as "Frankenboard" eh?

IDE only knows which chip you are using; doesn't care about the rest of the board.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

kf2qd

As long as the chip is a 328/328P the code should run the same whether it was loaded using the Bootloader or using an ISP.

retrolefty

#3
Jan 21, 2013, 06:55 pm Last Edit: Jan 21, 2013, 07:15 pm by retrolefty Reason: 1
Quote
For example the sweep and knob sketches result in the servo rotating clockwise continuously no matter what changes I make to the code.


That's because you are not using a real servo, but rather you have an ex-servo. Once a servo has been modified for continuous rotation is ceases to be a servo but rather has been morphed into becoming a bidirectional, variable speed, geared motor drive. So while you still need to use the arduino servo software to interface and control your ex-servo, the write values you send to it causes it to do different things then a standard unmodified servo does with the same write values.

This has nothing to do with running sketch code on a arduino board Vs a standalone circuit.

Lefty


I may have misstated that line. I meant to say that it only rotates in a clockwise direction at the same rate, it does hit the stop, but it keeps trying. And knob and sweep do the same thing. I can change the output pin, but nothing else in the code seems to affect anything.
I am beginning to get the sneaking suspicion i just did some really lame small mistake.

Am I correct in thinking that the IDE does make subtle changes though? Such as pin 9 in the IDE would be translated to pin 14 in the code?

CrossRoads

Only if your code is redefining it. Or are misinterpreting the pin mapping.
Got something you can post?
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

That is an extremely useful little .jpg there. I was looking at the schematic and thinking "pin 9" in the code referred to the the ninth pin down the left side to begin with. Then I found the pin map http://arduino.cc/en/uploads/Hacking/Atmega168PinMap2.png and thought that the IDE was doing something in compiling the code so that the signal went to the 14th pin of the controller.  So following this tutorial http://arduino.cc/en/uploads/Hacking/Atmega168PinMap2.png I connect the yellow lead from my servo to the 14th pin on my Atmega328 (which is the only pin putting out any kind of signal) and it should work right?
Looking at the .jpg you provided, how would I know which 9 the code would output on?

CrossRoads

Code: [Select]

pinMode(9, OUTPUT);

refers to the pin marked D9 on the symbol, physical pin 15.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

Ok, I can see that now. Any idea why my controller is just rotating the servo clockwise like crazy even with the pot disconnected?

Go Up