Skip to content

Instantly share code, notes, and snippets.

@Mango-kid
Mango-kid / RB-BT.3.0.1 Wireless Sensor.ino
Last active December 28, 2015 17:29
Reads a sensor attached to A0 and sends it over the Bluetooth module. The sensor can then be read from a COM port on a PC
// checkout for more -> https://github.com/Roboteurs/Product-code/tree/master/BT/BT.3.0.1
#include "PAN1321.h"
const int analogInPin = A0;
int sensorValue = 0;
// the serial and bluetooth are all intialized in Init_Bluetooth
void setup() {
Init_Bluetooth();
@Mango-kid
Mango-kid / RB-MD.3.0.1 Read Sensor.ino
Created November 26, 2013 19:30
This program will read a sensor attached to the RB-MD.3.0.1 booster pack. the sensor it reads is on pin 2
/* This program will read a sensor attached to the RB-MD.3.0.1 booster pack.
the sensor it reads is on pin 2
@Directions: To view the output of this program open device manager and look under COM and LPT
you should see the lauchpad listed as "COMXX" use putty and open this COM port to view the
values. Check the video tutorial for more info
*/
void setup() {
@Mango-kid
Mango-kid / RB-MD.3.0.1 Servo Control.ino
Created November 26, 2013 19:32
This program will actuate a servo motor back and forth from 0 to 180 degrees
/* This program will actuate a servo motor back and forth from 0 to 180 degrees
*/
#include <Servo.h>
// define the servo object and the angle variable
Servo servo1;
int angle1 = 0;
void setup() {
@Mango-kid
Mango-kid / RB-MD.3.0.1 Stepper Driving.ino
Created November 26, 2013 19:33
This program will drive a 2 phase (4 wire) bipolar stepper motor with the RB-MD.3.0.1 luachpad booster pack
/* This program will drive a 2 phase (4 wire) bipolar stepper motor
with the RB-MD.3.0.1 luachpad booster pack
*/
#include <Stepper.h>
const int stepsToTravel = 200;
// setup stepper motor on correct pins to match the RB-MD.3.0.1
Stepper myStepper(stepsPerRevolution, 9,10,12,13);
@Mango-kid
Mango-kid / bammer.ino
Created July 5, 2016 03:02
Basic motor control with the Bammer Motor driver
/*
* This program is used to control a Bammer motor driver. This code may also
* be compatable with other motor drivers with direction and enable pins
*/
// define the pins that are connected to the Bammer
const int motor1_direction = 2;
const int motor1_pwm = 9;
const int motor1_sleep = 4;
const int analogInPin = A0;
int sensorValue = 0;
void setup() {
Serial.begin(9600);
}
void loop() {
/* Read Quadrature Encoder
* Connect Encoder to Pins encoder0PinA, encoder0PinB, and +5V.
*
* Sketch by max wolf / www.meso.net
* v. 0.1 - very basic functions - mw 20061220
*
*/
int val;
/*
Stepper Motor Control - one revolution
This program drives a unipolar or bipolar stepper motor.
The motor is attached to digital pins 8 - 11 of the Arduino.
The motor should revolve one revolution in one direction, then
one revolution in the other direction.
#include "mbed.h"
#include "rtos.h"
/* the pins that will be used on the Nucleo board */
AnalogIn analog_value(A0);
PwmOut mypwm(D10);
DigitalOut directionPin(D2);
DigitalOut enablePin(D3);
DigitalOut led1(LED1);
#!/usr/bin/python3
import Slush
import time
b = Slush.sBoard()
#define the motor that is being used
m1 = Slush.Motor(0)
#print the position of the motor before we spin it