Month: April 2016

ESP8266 & Arduino IDE

ESP8266 & Arduino IDE

If you’ve been reading my blog, you will have seen I’ve worked on a lot on the ESPs and LUA. LUA is a very easy language to learn and I had used it before for programming on my tablet. I did seem however a bit unstable at times so I was very happy to read about Arduino IDE for the ESP8266 boards. Mind you, I have never programmed in C (for some reason never had a project that really needed it) and had never used the Arduino IDE until I started with the Wink robot.

So I have tried a few tests and now can connect to a wifi network, blink a led and actually read from an I2C bus so it’s time for some more serious work 🙂

To get this working there are 2 things you need to do, install Arduino and install the ESP boards. There are 2 webpages I used to get things working:

It does not really make sense to write an article on how to do this as they did a good job on describing it. I will however work through the different examples I’ve used to get a good feel for Arduino IDE with the ESP8266 in upcoming articles.

Advertisements
Wink, exercise 11

Wink, exercise 11

Wink exercises

Download the image below and print it to fit on an A4 page. The code can be found below the image. More exercises can be found here and more articles on Wink here.

Instructions

Kids

Make Wink turn it’s eyes blue, play a startup sound and wait for the button to be pressed. After the button is pressed, turn the eyes green, wait 2 seconds and drive away in a straight line.

By having Wink wait, you can place him on the table or a paper, ready for the exercise. We will use this set of instructions again and it will be shown by using this symbol:

ChirpWait

Parents

This exercise is to experience the difference between putting something in loop() which is executed over and over again and setup() which is only executed once. In this case, the code has to be put in setup(). In a lot of upcoming exercises, this startup sequence will be used since it allows for placing the Wink correctly, ready to begin it’s exercise.

Please make sure that Wink cannot drive off the table.

This exercise assumes that all lessons up to and including lesson 4 have been studied.

Exercise

Download links: no text, English, Dutch

Wink 11

Code

#include "WinkHardware.h"
void setup(){
  hardwareBegin();
  playStartChirp();
  eyesBlue(100);
  waitForButton();
  eyesGreen(100);
  delay(2000);
}

void loop(){
  motors(88,100);
}
Wink, exercise 10

Wink, exercise 10

Wink exercises

Download the image below and print it to fit on an A4 page. The code can be found below the image. More exercises can be found here and more articles on Wink here.

Instructions

Kids

Make Wink drive in a triangle.

Parents

This exercise is the extension of exercise 9. In this case Wink has to drive in a triangle.

Please make sure that Wink cannot drive off the table.

This exercise assumes that all lessons up to and including lesson 3 have been studied.

Exercise

Download links: no text, English, Dutch

Wink 10

Code

#include "WinkHardware.h"
void setup(){
  hardwareBegin();
}

void loop(){
  motors(42,50);
  delay(2000);
  beStill();
  delay(20);
  motors(42,-50);
  delay(387);
  beStill();
  delay(20);
}

 

Wink, exercise 09

Wink, exercise 09

Wink exercises

Download the image below and print it to fit on an A4 page. The code can be found below the image. More exercises can be found here and more articles on Wink here.

Instructions

Kids

Make Wink drive in a square.

Parents

This exercise is the extension of exercise 8. In this case Wink has to drive in a square. To make it do that nice and tightly, it helps to stop Wink between moving and turning and vice versa. In the code below, I have chosen to have Wink spin around it’s axis by moving the left motor forward and the right engine backward.

Please make sure that Wink cannot drive off the table.

This exercise assumes that all lessons up to and including lesson 3 have been studied.

Exercise

Download links: no text, English, Dutch

Wink 09

Code

#include "WinkHardware.h"
void setup(){
  hardwareBegin();
}

void loop(){
  motors(42,50);
  delay(2000);
  beStill();
  delay(20);
  motors(42,-50);
  delay(290);
  beStill();
  delay(20);
}

 

Wink, exercise 08

Wink, exercise 08

Wink exercises

Download the image below and print it to fit on an A4 page. The code can be found below the image. More exercises can be found here and more articles on Wink here.

Instructions

Kids

Get Wink to drive forward, followed by a sharp corner.

Parents

This exercise is also not that difficult. It leads up to the next exercise where the corners will have to be more exact. Extra credit if they remember to use the factor from exercise 6 and have Wink move in a straight line.

Please make sure that Wink cannot drive off the table.

This exercise assumes that all lessons up to and including lesson 3 have been studied.

Exercise

Download links: no text, English, Dutch

Wink 08

Code

#include "WinkHardware.h"
void setup(){
  hardwareBegin();
}

void loop(){
  motors(88,100);
  delay(500);
  motors(88,0);
  delay(240);
}

 

Wink, exercise 07

Wink, exercise 07

Wink exercises

Download the image below and print it to fit on an A4 page. The code can be found below the image. More exercises can be found here and more articles on Wink here.

Instructions

Kids

Make Wink move backwards in a straight line.

Parents

This exercise is similar to exercise 06, but instead Wink should move backwards. With any luck, the factor used to get the motors aligned moving forward in a straight line can be used to move Wink backwards in a straight line.

Please make sure that Wink cannot drive off the table.

This exercise assumes that all lessons up to and including lesson 3 have been studied.

Exercise

Download links: no text, English, Dutch

Wink 07

Code

#include "WinkHardware.h"
void setup(){
  hardwareBegin();
}

void loop(){
  motors(-88,-100);
}

 

Wink, exercise 06

Wink, exercise 06

Wink exercises

Download the image below and print it to fit on an A4 page. The code can be found below the image. More exercises can be found here and more articles on Wink here.

Instructions

Kids

Each Wink is different as are it’s legs (the motors). This means that Wink might not drive in a straight line by itself. The exercise is to make Wink drive forward in a straight line.

Parents

The motors on Wink are not all identical which means that if you run them at motors(100,100), Wink might not run in a straight line. One of the motors will have to be running a bit slower (or faster) for Wink to drive in a straight line. It is also possible that the factor you use to get Wink to drive straight differs per surface type (paper, table etc). The resulting program is not that difficult but in this case the trial and error to get Wink to move straight is where the effort is.

Please make sure that Wink cannot drive off the table.

This exercise assumes that all lessons up to and including lesson 3 have been studied.

Exercise

Download links: no text, English, Dutch

Wink 06

Code

#include "WinkHardware.h"
void setup(){
  hardwareBegin();
}

void loop(){
  motors(88,100);
}

 

Wink, exercise 05

Wink, exercise 05

Wink exercises

Download the image below and print it to fit on an A4 page. The code can be found below the image. More exercises can be found here and more articles on Wink here.

Instructions

Kids

Make Wink run in cirkels while it’s eyes alternate between red and blue where each eye is a different color.

Parents

The idea is that Wink runs in a bigger circle, so motors should be run with one bigger value than the other, but not with a value of 0 because than it will just spin around on one leg.

Please make sure that Wink cannot drive off the table.

This exercise assumes that all lessons up to and including lesson 3 have been studied.

Exercise

Download links: no text, English, Dutch

Wink 05

Code

#include "WinkHardware.h"
void setup(){
  hardwareBegin();
}

void loop(){
  motors(100,50);
  leftRed(100);
  rightBlue(100);
  delay(500);
  rightRed(100);
  leftBlue(100);
  delay(500);
}

 

Wink, exercise 04

Wink, exercise 04

Wink exercises

Download the image below and print it to fit on an A4 page. The code can be found below the image. More exercises can be found here and more articles on Wink here.

Instructions

Kids

Turn the eyes pink, have Wink move forward, turn the eyes purple and have Wink move back and turn the eyes green. Let Wink wait and repeat.

Parents

What they will accomplish with this exercise is that they can see that Wink can move in two directions. They will also see that Wink does not necessarily drive in a straight line. That is fine for this exercise. The straight line will be covered in exercise 6 and 7.

If they need help, moving Wink backwards means you give it negative numbers as motors arguments.

Please make sure that Wink cannot drive off the table.

This exercise assumes that all lessons up to and including lesson 3 have been studied.

Exercise

Download links: no text, English, Dutch

Wink 04

Code

#include "WinkHardware.h"
void setup(){
  hardwareBegin();
}

void loop(){
  eyesPink(100);
  motors(100,100);
  delay(1000);
  eyesPurple(100);
  motors(-100,-100);
  delay(1000);
  eyesGreen(100);
  delay(300);
}

 

Wink, exercise 03

Wink, exercise 03

Wink exercises

Download the image below and print it to fit on an A4 page. The code can be found below the image. More exercises can be found here and more articles on Wink here.

Instructions

Kids

Turn the right eye of Wink orange, let him move forward a bit and turn both eyes green. You should be able to see that the eyes are green.

Parents

The first exercise to have Wink move. They should put some kind of delay after turning the eyes green. If they don’t, one eye will turn Orange straight after. If you want to be really picky, you should make sure that they turn off the left eye in the loop, otherwise after the first run, the eyes won’t be off and orange but green and orange.

Please make sure that Wink cannot drive off the table.

This exercise assumes that all lessons up to and including lesson 3 have been studied.

Exercise

Download links: no text, English, Dutch

Wink 03

Code

#include "WinkHardware.h"
void setup(){
  hardwareBegin();
}

void loop(){
  rightOrange(100);
  leftOff();
  motors(100,100);
  delay(500);
  eyesGreen(100);
  delay(500);
}