www.nexusrobot.com Robot Kits manual
47
unsigned int
getSpeedMMPS
() const
Get the speed (millimeter per second)
This will lie within the range specified at
MotorWheel::getspeedCMPM
().
See:
MotorWheel::getspeedCMPM
()
unsigned int
setSpeedMMPS
(unsigned int mm,bool dir)
Set the speed .
This will lie within the range specified at
MotorWheel::setspeedCMPM
() and
MotorWheel::getspeedCMPM
().
See:
MotorWheel::setspeedCMPM
()
MotorWheel::getspeedCMPM
()
For example:
#include <PinChangeInt.h>
#include <PinChangeIntConfig.h>
#include <PID_Beta6.h>
#include <MotorWheel.h>
#ifndef MICROS_PER_SEC
#define MICROS_PER_SEC 1000000
#endif
irqISR(irq1,isr1);
//This will create a MotorWheel object called Wheel1
MotorWheel wheel1(9,8,6,7,&irq1); // Motor PWM:Pin9, DIR:Pin8, Encoder A:Pin6, B:Pin7
void setup() {
TCCR1B=TCCR1B&0xf8|0x01;
// Pin9,Pin10 PWM 31250Hz, Silent PWM
wheel1.setSpeedMMPS(100,DIR_ADVANCE);
//Set the pwm speed 100 direction
wheel1.PIDEnable(KC,TAUI,TAUD,10); // used whewl1 to call the PIDEnable
Serial.begin(19200);
}
void loop() {
wheel1.PIDRegulate();
//regulate
the
PID
if(millis()%500==0)
{
Serial.print("speedRPM>
");
Summary of Contents for Nexus Robot
Page 74: ...www nexusrobot com Robot Kits manual 70 Sample Wiring Diagram for RB004 2WD V2 0...
Page 92: ...www nexusrobot com Robot Kits manual 88 Diagram for Omni3WD_V1 0...
Page 96: ...www nexusrobot com Robot Kits manual 92 Diagram_Omni3WD_V3 3...
Page 118: ...www nexusrobot com Robot Kits manual 114 Sample Wiring Diagram for RB011 Mecanum 4WD V4 1...