I greatly appreciate DroidScript enabling you to edit programs directly from a Wifi connected desktop computer. All you need is a desktop web browser. You don’t need to install Eclipse, Java, simulators, Netbeans or anything. You press a button in DroidScript and the app fires up a web server on your Android device. From your web browser, you can start making new apps, exploring and running sample programs, and checking out the documentation.
What features of Android can you access using DroidScript?
- You can use the GPS, Compass, Camera, and Accelerometer.
- DroidScript can do basic graphics functions.
- According to the documentation, you can send and receive emails and SMS.
- You can control Arduino and Lego NXT.
- On a personal project, I used DroidScript to send commands to an Arduino through serial communication.
- You can also fire up a custom web server so that your phone can respond to HTTP requests.
I think users will appreciate the effective samples and documentation.
For the young programmer, hobby programmer or someone who needs some quick code duck tape on Android, DroidScript is worth checking out. If you need help, they have an active forum community at https://groups.google.com/forum/#!forum/androidscript
Let’s Build a Robot Control program
In our previous blog post, we showed you how to build your own DIY servo robot using Arduino. Let’s assume that the Arduino code follows the following protocol when it receives bytes on the serial port:
- When w is received, the robot moves forward.
- When s is received, the robot moves backward.
- When a is received, the robot moves left.
- When d is received, the robot moves right.
- When the space character is received, the robot stops all motion.
Here’s your test robot using an Arduino Nano.
For this robot design, I want to use my Android device and a blue tooth keyboard to remotely control the Android device. The blue tooth keyboard helps me control the robot at a distance. You will also need to obtain a USB to micro-USB adapter like this one to connect your Android device to Arduino. Here’s the code needed to control the robot.
Robot control program active
When the application starts, we need to configure the serial port to a baud rate of 9600.
//Called after application is started.
app.ShowPopup( "Robot control active" );
usb = app.CreateUSBSerial(9600);
The following functions define our protocol for sending messages to the Arduino. In each case, we’re just sending the appropriate character to the serial port.
usb.Write( "w" );
usb.Write( "s" );
usb.Write( "a" );
usb.Write( " " );
usb.Write( "d" );
To accept keyboard input from the user, we use the following switch statement:
DroidScript has a really easy function for text to speech too.
var pitch = 1.0, speed = 1.0;
app.TextToSpeech( "Resistance is futile. You will be assimilated.", pitch, speed );
Make sure to download DroidScript and check out the other cool features it offers. We love to hear from our readers! We would enjoy seeing your robots or your apps! Leave a comment below. All the best!
Top Stories on InspiredToEducate.NET
Learning To Code
- Learn to Build Your Own Conversational Bot using ChatScript
- 17 Fun Tools To Teach Kids To Code by @ChrisBetcher
- Benefits of Teaching Kids To Code That No One Is Talking About
- Easy Recipes for Building Android Apps using MIT App Inventor
- 12 Steps To 3D Print Your Minecraft Creations
- How to Build Your Mobile App using HTML
- Simple Minecraft Programming Using ScriptCraftJS
- Why hate science?
- 7 ideas for creating a student centered learning environment by Paul Andersen
- Using candy to teach DNA structure