Wednesday 12 March 2014

SPIK3R operates with IR Beacon

Here is a small LeJOS program to demonstrate the use of IR beacon to operate SPIK3R. I would suggest you to go through my previous article SPIK3R With IR Sensor before going through the current article. I am operating the same robot (SPIK3R) with the Beacon here.  I would also suggest you to go through the operation of the EV3 IR Beacon with the link EV3 IR Beacon Tutorial. This tutorial will make you familiar with the concepts of Beacon channels, Beacon buttons etc. 

Let me explain my code below. My code consists of two classes EV3IRBeacon and InfraredSignalCheckerThread. The EV3IRBeacon class initializes the IR Sensor at port S1. It also spawns a thread InfraredSignalCheckerThread and passes the IR Sensor Object to it. The thread then initializes the large motor at port B and also works with the IR Sensor object as follows. The thread keeps listening to the IR sensor commands until the ESCAPE button is pressed. The IR commands are sent over Beacon channel 0. The remote command is received in the form of an integer (1, 2, 3) which represent the top-left, bottom-left and top-right buttons respectively. Pressing button 1, rotates the large motor (connected to port B), forward. Pressing button 2, rotates the motor backwards and pressing button 3, stops the motor. 

Below is a small clip to show the performance of the program (under construction ..).  

No comments:

Post a Comment