onsdag den 28. januar 2009

Construction of the human controlled bat

Goal:
To make a simple human controlled Pong bat resembling the computer controlled bat, but controlled via bluetooth.

Plan:
  • To copy the computer controlled bat-construction omitting the sensors.
  • To adapt the lejos bluetooth example code to make a simple controller for the bat.
Activities:

Already satisfied with the stability of the autonomus bat, constructing the human controlled bat was just a matter of copying the already existing bat-construction. Except for all the sensors, a perfect copy of the autonomous bat of was constructed in less than half an hour.

For enabling bluetooth control we needed two programs, one on the NXT receiving signals and converting it to a proper engine response, and one located on a laptop sending signals to the NXT.

The program on the NXT will wait for an incoming bluetooth connection, when this is established, it will continuously check the input stream for integers. The program reads an integer in the range 1-4 and perform the corresponding action such as moving the bat forwards or backwards.

The program sending signals to the NXT is also responsible for providing a simple user interface. The program uses itself as a keylistener and switches on the input A,C and Q for connecting and disconnecting and W, S for moving the bat.

Ingen kommentarer:

tagtagtag