This is a skill to celebrate Christmas in a new way with alexa and lego , i am making a santa with Lego mindstorms that respond to alexa and start the celebration .
Register an Alexa Gadget in the Alexa Developer Consolefirst we need to register alexa gadget to connect the device to the ev3 brick
for more details check the missions here
https://www.hackster.io/alexagadgets/lego-mindstorms-voice-challenge-mission-1-f31925
make sure custom interface Controller is enabled
use the code provided and json for the interaction model
save and build the model , now we are ready for the next part
Instructions are provided by robocamp.eu as a free lesson , register and login
then you have free access to the build instructions and ev3 code (you can check it out but this is not the code we are going to use , we need the code in python provided below to interact with Alexa instead of the remote control )
i have provided a direct link to the instructions with the login and password provided here as a quick way to directly access the tutorial (this is time limited account i will try to keep it alive but if it didn't work for any reason you need to register and access the free lessons )
website : https://elearning.robocamp.eu/
Login: station37896.1
Password: 1bpz6s
the following part of the code handles Santa's sleigh movement around the Christmas tree . it basically rotate the medium motor to handle the reindeer movement and the large motors for the sleight motors ,
def _move(self, direction, duration: int, speed: int, is_blocking=False):
while True:
self.wheel.on_for_seconds(SpeedPercent(40), 2, block=False)
self._forward(speed,3)
time.sleep(1)
self.wheel.on_for_seconds(SpeedPercent(40), 2, block=False)
self._turn(speed)
time.sleep(1)
def _turn(self, speed):
self.drive.on_for_seconds(SpeedPercent(-speed), SpeedPercent(speed), 2, block=True)
def _forward(self,speed,duration):
self.drive.on_for_seconds(SpeedPercent(speed), SpeedPercent(speed), 4, block=True)
don't forget to add the santa.ini file also with the correct amazonId and alexaGadgetSecret from the first step
the Result
Comments