Sie sind auf Seite 1von 13

Let’s Get Started

Build 1 :
Simple Addition Calculator
Exercise :
1. DO simple addition calculator as
shown
2. Expand functionality by adding
multiple operations (multiply,
divide, minus)
Designer 3. Use more than three inputs

Block
Compile and MIT AI2
• Install MIT AI2 Companion from PlayStore
• Make sure phone and laptop connected on same WIFI
network
• Launch MIT AI2 from your phone
• Select connect > AI companion
• Scan QR code using MIT AI2
Build 2 :
Arduino Control LED
Hardware:
1. Arduino UNO
2. LED
3. Bluetooth module ( HC-05 or HC-06)
4. Male to male jumper wire
5. Breadboard
6. Android smart phone
Arduino code
int led = 9; // pin LED 9
int value; // initial value of input

void setup()
{
Serial.begin(9600); // Serial comm begin at 9600bps
pinMode(led, OUTPUT);
digitalWrite(led, LOW); // initial LED OFF
}

void loop()
{
while (Serial.available()) //read while data is present
{
value = Serial.read(); //value = serial read data from phone
if (value == 0) {
digitalWrite(led, LOW);
}
if (value == 1) {
digitalWrite(led, HIGH); // LED ON
}
delay(10);
}
}
Circuit Assemble

For the HC-05, the VCC is connected


to 5V, GND to GND, RX of HC-05 to
Arduino TX, while TX of HC-05 to
Arduino RX.
The AppInventor Designer
The AppInventor Blocks
Build 3 :
Arduino Control Servo
Hardware:
1. Arduino UNO
2. Servo motor
3. Bluetooth module ( HC-05 or HC-06)
4. Male to male jumper wire
5. Breadboard
6. Android smart phone
The appinventor design

Slider

Listpicker1
The AppInventor Blocks
Arduino code

#include< Servo.h > // include server library


Servo ser; // create servo object to control a servo
int poser = 90; // initial position of servo
int value; // initial value of input
void setup() {
Serial.begin(9600); // Serial comm begin at 9600bps
ser.attach(7); } // server is connected at pin 7
void loop() {
while(Serial.available()) { //read while data is present
value = Serial.read(); //value = serial read data from phone
poser = value ; //than position of servo motor
ser.write(poser); // the servo will move according to position
delay(15); }
}
Assemble the circuit and test It!!

Das könnte Ihnen auch gefallen