0
Offline
Jr. Member
Karma: 0
Posts: 63
Arduino rocks
|
 |
« Reply #15 on: January 24, 2010, 12:18:39 pm » |
So these right here, you'll need to change the numbers to reflect whatever pins your servos are connected to. const int rightPIN=5; //right servo const int leftPIN=3; //left servo
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Jr. Member
Karma: 0
Posts: 63
Arduino rocks
|
 |
« Reply #16 on: January 24, 2010, 12:20:40 pm » |
About the testlog.txt you can take that part out. I am trying to send data from a temperature sensor from the arduino to the web and it looks like I"m going to need an Arduino Mega to do that because one serial port doesn't seem to cut it.
There is about 6 or 7 lines int he php file dealing with reading from the txt file. You can just take that out if you wish.
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Newbie
Karma: 0
Posts: 20
Arduino rocks
|
 |
« Reply #17 on: January 24, 2010, 12:27:05 pm » |
Hi mate, I did check the pin assignments before I uploaded and changed it accordingly. erm I have not tried to light up an LED from a php code. I don't have a spare LED  .. does the Arduino have an onboard one?. I do get message display at the top of the page whenever I press a button, e.g. "The Guardino!Reverse Value = S SentLast Log Entry: Date: Time: Value:".. I installed Apache XAMPP, should I have installed WAMPSERVER?..
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Jr. Member
Karma: 0
Posts: 63
Arduino rocks
|
 |
« Reply #18 on: January 24, 2010, 12:37:53 pm » |
I would imagine that XAMPP should work...though not sure if it has a php server?? But it sounds like the php code is functioning properly.
I believe pin 13 is the onboard LED.
You might also try downloading "Processing." It has the same interface as the Arduino and has some built in example sketches to send serial data to the arduino. It's very easy to read serial data in that manner and therefore can help confirm where your trouble lies...either in the receiving or transmitting of the data over the serial port.
Change the LEDpin in my arduino code to 13 to see if I'm right about that on board LED. It should blink when it's not receiving any serial data so that can help you trouble shoot. If you press one of the buttons in php and the light doesn't go out, then the serial data isn't being recognized.
|
|
|
|
« Last Edit: January 24, 2010, 12:38:14 pm by linusb212 »
|
Logged
|
|
|
|
|
0
Offline
Newbie
Karma: 0
Posts: 20
Arduino rocks
|
 |
« Reply #19 on: January 24, 2010, 12:51:34 pm » |
I changed the pin assignment for the LED in the Arduino code and uploaded it. As you said, it the LED blinks repeatedly, then when I click a button it goes out. The repeated blinking does come back on after a few secs though.
I guess it's sending serial data to the Arduino, only it'snt doing anything for my servos. I am baffled.
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Jr. Member
Karma: 0
Posts: 63
Arduino rocks
|
 |
« Reply #20 on: January 24, 2010, 01:01:36 pm » |
Ok, well that is a good sign. It's just that the Arduino isn't properly interpreting the data.
If your servos aren't using PWM pins, they probably won't work in the way that I have them coded.
Quote form arduino reference pages: On newer Arduino boards (including the Mini and BT) with the ATmega168 chip, this function works on pins 3, 5, 6, 9, 10, and 11. Older USB and serial Arduino boards with an ATmega8 only support analogWrite() on pins 9, 10, and 11.
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Jr. Member
Karma: 0
Posts: 63
Arduino rocks
|
 |
« Reply #21 on: January 24, 2010, 01:05:11 pm » |
As a consolation, these are all things I should have mentioned in the beginning but being a noob myself I didn't think about them until you ran into problems and until I started thinking about what it might be is when it came to me.
In case you don't understand, the PWM pins allow signals of varying duration (I think that's the right description) instead of a simple HIGH/LOW. Analog.write commands are driving the servos, and analog.write only works with PWM pins. digital.write works on them all.
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Newbie
Karma: 0
Posts: 20
Arduino rocks
|
 |
« Reply #22 on: January 24, 2010, 01:12:39 pm » |
I have the ATmega328 though, so shouldn't that work?.. All the pins you mentioned are pwm pins on the 328 too right? As a consolation, these are all things I should have mentioned in the beginning but being a noob myself I didn't think about them until you ran into problems and until I started thinking about what it might be is when it came to me. Hey, no worries mate, I really appreciate your help.. I am learning a lot  .
|
|
|
|
« Last Edit: January 24, 2010, 01:16:49 pm by nurain »
|
Logged
|
|
|
|
|
0
Offline
Jr. Member
Karma: 0
Posts: 63
Arduino rocks
|
 |
« Reply #23 on: January 24, 2010, 01:36:29 pm » |
YEah, those are all PWM pins on the 328 as well. Let me know how it goes.
If you still don't have success, change those analogWrite lines to
digitalWrite (leftPIN,HIGH); digitalWrite (rightPIN,HIGH);
Have you tested your servo circuitry using a simple arduino sketch that doesn't rely on any external data. Just some basic code that moves the wheels?
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Newbie
Karma: 0
Posts: 20
Arduino rocks
|
 |
« Reply #24 on: January 24, 2010, 05:04:07 pm » |
YEah, those are all PWM pins on the 328 as well. Let me know how it goes.
If you still don't have success, change those analogWrite lines to
digitalWrite (leftPIN,HIGH); digitalWrite (rightPIN,HIGH);
Have you tested your servo circuitry using a simple arduino sketch that doesn't rely on any external data. Just some basic code that moves the wheels? I am getting nowhere  .. Still no reaction when I press the buttons. My servos work perfectly with code to automatically control the functions.
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Jr. Member
Karma: 0
Posts: 63
Arduino rocks
|
 |
« Reply #25 on: January 24, 2010, 06:27:04 pm » |
I had some problems getting the arduino to recognize certain characters sent from PHP, which is why the seemingly random usage of letters for the various controls of forward, backward, reverse. I was going to do simple A,B,C convention but it didn't recognize certain characters.
You may perhaps try defining the BYTE variable as a CHAR...I haven't tried that yet, but it's worth a try.
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Newbie
Karma: 0
Posts: 20
Arduino rocks
|
 |
« Reply #26 on: February 03, 2010, 01:34:43 pm » |
Hi linusb,
Sorry to bother you again but I am still having problems mate.. Any other suggestions?
My project is coming to an end and still unable to control the functions using PHP..
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Newbie
Karma: 0
Posts: 2
Arduino rocks
|
 |
« Reply #27 on: February 05, 2010, 05:43:04 pm » |
anybody tried transfer the data in and out a arduino thought the Ethernet shield to a server? by using PHP and MYSQL
any difference with the serial connection?
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Tesla Member
Karma: 50
Posts: 6530
Arduino rocks
|
 |
« Reply #28 on: February 05, 2010, 07:22:26 pm » |
My project is coming to an end and still unable to control the functions using PHP..
Ever consider dumping PHP?
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Newbie
Karma: 0
Posts: 20
Arduino rocks
|
 |
« Reply #29 on: February 07, 2010, 03:14:44 pm » |
Yeah I have.. but don't really know what else to use.. Others have suggested Python and Processing.. Don't even know where to start with that.
|
|
|
|
|
Logged
|
|
|
|
|
|