-->
Page 1 of 1

Arduino IDE 1.6.7, Servo Sweep example diesn´t work

PostPosted: Thu Mar 17, 2016 8:41 am
by Rince
Hi,

I´m using the Arduino IDE 1.6.7
All I was trying to do was the "Sweep" example for the servo.

It will run a few times, but afterwards it will give me an Expection.


This is my modified code:

Code: Select all
#include <Servo.h>

Servo myservo;  // create servo object to control a servo
// twelve servo objects can be created on most boards

int pos = 0;    // variable to store the servo position

void setup() {
  myservo.attach(4);  // attaches the servo on pin 9 to the servo object
  Serial.begin(115200);
}

void loop() {
  for (pos = 0; pos <= 180; pos += 1) { // goes from 0 degrees to 180 degrees
    // in steps of 1 degree
    Serial.println(pos);
    myservo.write(pos);              // tell servo to go to position in variable 'pos'
    delay(150);                       // waits 15ms for the servo to reach the position
  }
  for (pos = 180; pos >= 0; pos -= 1) { // goes from 180 degrees to 0 degrees
    Serial.println(pos);
    myservo.write(pos);              // tell servo to go to position in variable 'pos'
    delay(150);                       // waits 15ms for the servo to reach the position
  }
}




And this is the result:
Code: Select all0<\r><\n>
0<\r><\n>
1<\r><\n>
2<\r><\n>
3<\r><\n>
4<\r><\n>
5<\r><\n>
6<\r><\n>
7<\r><\n>
8<\r><\n>
9<\r><\n>
10<\r><\n>
11<\r><\n>
<\r><\n>
Exception (0):<\r><\n>
epc1=0x40224c5f epc2=0x00000000 epc3=0x00000000 excvaddr=0x00000000 depc=0x00000000<\r><\n>
<\r><\n>
ctx: sys <\r><\n>
sp: 3ffffde0 end: 3fffffb0 offset: 01a0<\r><\n>
<\r><\n>
>>>stack>>><\r><\n>
3fffff80:  8101a8c0 40224779 00000002 3fffdcb0  <\r><\n>
3fffff90:  4020921b 3fff031c 00000000 3fff031c  <\r><\n>
3fffffa0:  3fff0134 3fffdc80 3fffdab0 40000f49  <\r><\n>
<<<stack<<<<\r><\n>
<\r><\n>
 ets Jan  8 2013,rst cause:2, boot mode:(1,7)<\r><\n>
<\r><\n>
<\r><\n>
 ets Jan  8 2013,rst cause:4, boot mode:(1,7)<\r><\n>
<\r><\n>
wdt reset



Also with nothing connected to the ESP the result is the very same.

Any ideas?

Re: Arduino IDE 1.6.7, Servo Sweep example diesn´t work

PostPosted: Sat Mar 19, 2016 4:00 pm
by rgrokett
I ran your program on my Adafruit HUZZAH ESP8266 for 15 minutes w/o any issues.
I suspect your problem may be one of the following:
1) Power issue (is your 3.3v supply stable and noise free?)
2) Flaky memory in the ESP8266.

Either of these probably would show errors on most other programs. Have you tried using it as a WiFi web server? That gives a pretty good workout for the module.

Are you using a HUZZAH ESP8266. I like the Adafruit modules as they have been very reliable for me and include power conditioning built-in, so can run 5-12v power. They may be a little more expensive, but are worth it to reduce hassle!

-- Russell

Re: Arduino IDE 1.6.7, Servo Sweep example diesn´t work

PostPosted: Tue Mar 22, 2016 7:33 am
by Rince
Thanks for the answer.
I'm using a NodeMCU Dev Board. Powered via USB.
As the sketch isn't using any WLAN, I guess power isn't my problem. Also, without servo connected, it isn't working. It keeps crashing.

But I will give another board a try :)