Show Posts
|
|
Pages: [1] 2 3 4
|
|
3
|
Using Arduino / Programming Questions / Re: Servo control
|
on: March 18, 2012, 05:01:56 am
|
This probably isn't right token = strtok(NULL, ","); edit, try this:
void parseBuffer() { if (strlen(buffer) > 0) { int vals[] = {0, 0, 0, 0, 0}; byte index = 0; char *token = strtok(buffer, ","); while (token) { vals[index++] = atoi(token); token = strtok(buffer, ","); } // print vals for (int i = 0; i < 5; i++) { Serial.print(vals[i]); Serial.print(" - "); } Serial.println(); } }
|
|
|
|
|
5
|
Using Arduino / Programming Questions / Re: Atmega1280 Fast 10-bit PWM
|
on: March 16, 2012, 02:48:07 pm
|
|
Checked that (TCCR5A+B) already and they look ok.
Btw, the voltage seems to be around .62 when not "max" which is around 1.2 or something.
Do you have any code for pwm on atmega1280 that is known to work? I tried a couple of different settings with little luck..
On a side note, analogWrite works.
|
|
|
|
|
6
|
Using Arduino / Programming Questions / Atmega1280 Fast 10-bit PWM
|
on: March 16, 2012, 12:33:20 pm
|
void setup() { pinMode(45, OUTPUT); // Or DDRL |= _BV(PL4); TCCR5A = _BV(COM5B1) | _BV(WGM51) | _BV(WGM50); TCCR5B = _BV(WGM52) | _BV(CS50); OCR5B = 512; }
void loop() { }
This isn't doing what I think the datasheet says it should be doing.. Did I forget some registers or something? Should be no prescaling with 10 bit fast pwm and pin 45 on the arduino mega set to set on bottom and clear on match.. AFAIK timer 5 port b is on pin 45 on the arduino mega.. If I set the ocr5b to 1023 the led lights up a little bit, but not much -- at all other values it's barely visible.
|
|
|
|
|
8
|
Using Arduino / Microcontrollers / Re: Likelihood of fake atmega8
|
on: March 13, 2012, 03:48:58 pm
|
|
@NI$HANT - you have several typos and I don't see any in my sentences so don't quite get where the hostile attitude comes from....
At any rate, I have now bricked the two atmega328ps I got from futurlec, which I don't suspect to be fake (and now I really don't think the cheap-o-hong-kong ones were either).. So most likely something else wrong, but I can't understand what is wrong.
Everything works correctly until they decide not to cooperate. The last one I remember quite clearly. Had done this several times already, but: I burned the fuses (all three of them), flash and lock bits. Avrdude says _everything_ is okay and everything is verified ok. But (I was just running this several times to see if it would fail) then it suddenly reported 0xffffff..
Could it be my custom circuit board? Avrdude on mac? Tinyisp? usb2serial board? I'm really at a loss now -- everything worked and then it didn't. If I put a new chip in it works, but stops after a while..
Btw, last time I didn't touch the board or anything between working and failure so not esd.
edit: and what I have programmed on them seems to work so maybe somehow the fuses can have gotten set to disable isp? but how would that happen? I was just arrow up and enter when it didn't work anymore :/
|
|
|
|
|
9
|
Using Arduino / Microcontrollers / Likelihood of fake atmega8
|
on: March 12, 2012, 10:03:59 am
|
|
I ordered 3 atmega8a-pu for the net sum of US$6.30 including shipping from china and they have been most difficult.. How likely is it that they are fake/made by someone other than atmel or me mishandling them that has caused them to become more and more difficult? Now at the point of only one of them returning an id other than 0xffffff...
The print on them is a lot weaker than the 328p's I got today and the date says october last year (ordered at the end of january)
|
|
|
|
|
11
|
Using Arduino / Programming Questions / Re: Reading last sent command from Serial
|
on: March 12, 2012, 09:40:09 am
|
|
This doesn't seem to do what you think it will..
Move blinkmodeon outisde the function. It will always be set to 1 when you enter the function (probably right after you set it to 0 and the while loop ends). No way to know without the rest of the coude though...
|
|
|
|
|
13
|
Using Arduino / Microcontrollers / Re: Programming new Atmega328-PU
|
on: March 11, 2012, 04:24:08 pm
|
Btw, what I have done is buy a USB->RS232 board and build a programmer (one chip programming another I which can just take in and out). My first circuit board so pretty simple task  Or you can just keep it on the breadboard and put the programs directly on the chip and don't bother with the bootloader. I might consider using a bootloader if I can manage to program stuff wirelessly though..
|
|
|
|
|
14
|
Using Arduino / Programming Questions / Re: Help with Ajax on Arduino
|
on: March 11, 2012, 03:46:02 pm
|
|
First thing is you would have to detect (in the sketch) that there is an ajax-request instead of the first page request. and if so just output the data instead of the whole page (don't know how the ethernet thingy works but normal would be to just change the url slightly)
You can even use jquery given that you have internet access on whatever device you are using to access the arduino (google cdn jquery)
1. Figure out how to detect wether to return page or ajax-data 2. Add jquery if you want (script tag in the sketch html output pointing to google cdn jquery) 3. Replace part of the page using jquery or normal ajax-request. Probably easier replacing just html instead of parsing json -- with jquery that would just be $.update something something
This might be easier trying it on a pc first though..
*watching amish ppl on tv.. odd*
Btw, pursuing the php on arduino route any further will not help you...
|
|
|
|
|