theuser42
Published © LGPL

First Bot

This is my first bot.

BeginnerFull instructions provided3 hours697
First Bot

Things used in this project

Hardware components

Sabortooth 2x5 motor controller
×1
Lynxmotion Tri-Track Chassis Kit
×1
Jumper wires (generic)
Jumper wires (generic)
×1
SparkFun Simblee BLE Breakout - RFD77101
SparkFun Simblee BLE Breakout - RFD77101
×1
Adafruit TXB0104 Bi-Directional Level Shifter
×1

Software apps and online services

Arduino IDE
Arduino IDE
RFduino simbleeformoble

Hand tools and fabrication machines

Soldering iron (generic)
Soldering iron (generic)

Story

Read more

Schematics

BLE with serial level shifter wiring

Code

Firstbot

Arduino
This is a simple BLE robot to make...
/*
*
* Date: 6-1-2018
* Made by: theuser32
* Devices used: Simblee BLE (RFD77201 and RFD22126), Sabortooth 2x5, and TXB0104 * Level shifter. 
* Decreiption: This code is a BLE controllor from a moble device to control a * * Robot that uses a sabortooth motor controller. This code can be used by the 
* Sabortooth 2x60 as well for big bots. 
*
*/

#include <SimbleeForMobile.h>
#include <SabertoothSimplified.h>

SabertoothSimplified ST;

uint8_t ui_button[4];

void setup() {
   SabertoothTXPinSerial.begin(9600);
  ST.drive(0);
  ST.turn(0);
  // put your setup code here, to run once:
  SimbleeForMobile.deviceName = "Robot";
  SimbleeForMobile.advertisementData = "tank";
  SimbleeForMobile.domain = "tank.simblee.com";
  // Begin Simblee UI
  SimbleeForMobile.begin();

}


void loop() {
  // put your main code here, to run repeatedly:
  // process must be called in the loop for Simblee UI
  SimbleeForMobile.process();  
}


/*
 * SimbleeForMobile UI callback requesting the user interface
 */
void ui()
{  
  SimbleeForMobile.beginScreen();
  SimbleeForMobile.beginScreen(WHITE);
  ui_button[0] = SimbleeForMobile.drawButton(100,300,85,"FOWARD");
  ui_button[1] = SimbleeForMobile.drawButton(30,350,85,"LEFT");
  ui_button[2] = SimbleeForMobile.drawButton(175,350,85,"RIGHT");
  ui_button[3] = SimbleeForMobile.drawButton(100,400,85,"REVERSE");
     
     SimbleeForMobile.setEvents(ui_button[0], EVENT_PRESS | EVENT_RELEASE);
     SimbleeForMobile.setEvents(ui_button[1], EVENT_PRESS | EVENT_RELEASE);
     SimbleeForMobile.setEvents(ui_button[2], EVENT_PRESS | EVENT_RELEASE);
     SimbleeForMobile.setEvents(ui_button[3], EVENT_PRESS | EVENT_RELEASE);
     
  SimbleeForMobile.endScreen();
}

void forward(){
  ST.drive(127); //This makes the Robot drive forward at full speed. 
}

void revirce(){
  ST.drive(-127); // backwards at full speed never mind the spelling it was on
}                // it was to be that way.  

void lift(){
  ST.turn(127); // Left full speed
}

void right(){  
  ST.turn(-127); // right full speed
}

void turnstop(){ 
  ST.turn(0); //stops the turning
}
void fstop(){ //stops the robot. 
  ST.drive(0);
}


/*
 * SimbleeForMobile event callback method. This is the code that give your   
 * simblee device away to know you have press or release a button. 
 */
void ui_event(event_t &event)
{
  if (event.id == ui_button[0]){
   if (event.type == EVENT_PRESS){
    forward();
   }
  }
   if (event.id == ui_button[0]){
   if (event.type == EVENT_RELEASE){
    fstop(); 
    }
   }
  
   if (event.id == ui_button[1]){
   if (event.type == EVENT_PRESS){
    lift();
   }
  }
   if (event.id == ui_button[1]){
   if (event.type == EVENT_RELEASE){
    turnstop(); 
    }
   }
  
   if (event.id == ui_button[2]){
   if (event.type == EVENT_PRESS){
    right();
   }
  }
  if (event.id == ui_button[2]){
   if (event.type == EVENT_RELEASE){
    turnstop(); 
    }
   }
  
  if (event.id == ui_button[3]){
   if (event.type == EVENT_PRESS){
    revirce();
   }
  }
  if (event.id == ui_button[3]){
   if (event.type == EVENT_RELEASE){
    fstop(); 
    }
   }
}

Credits

theuser42

theuser42

5 projects • 3 followers
I have been making for sometime now in the software world with Visual Basic 6.0/.NET. Hardware control is what i found a passion.

Comments