Program for testing the motor with SY202 connection from the application board to the L298 motor driver board.

Dependencies:   MotCon mbed

SY202 Motor Test Program

This program exercises a DC motor driver using pins 23, 24, and 25 as (PWM, DIR1, DIR2 respectively) motor control signals on the mbed application board. These pins are also tied to the on-board RGB LED.

/media/uploads/jebradshaw/lab_05_-_actuation.pdf - PDF of the Actuator Lab

Files at this revision

API Documentation at this revision

Comitter:
jebradshaw
Date:
Thu Mar 01 13:19:16 2018 +0000
Parent:
0:0da08bb74f7b
Commit message:
Added LCD output for Application board for SY202 motor test program

Changed in this revision

C12832_lcd.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/C12832_lcd.lib	Thu Mar 01 13:19:16 2018 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/dreschpe/code/C12832_lcd/#468cdccff7af
--- a/main.cpp	Wed Feb 28 14:59:53 2018 +0000
+++ b/main.cpp	Thu Mar 01 13:19:16 2018 +0000
@@ -2,21 +2,37 @@
 // Program for testing Motor control port on SY202 application board to L293 interface
 #include "mbed.h"
 #include "MotCon.h"     //uses the MotCon.h library for controlling the motor ports
+#include "C12832_lcd.h"
 
 //PC serial connection
 Serial pc(USBTX, USBRX);    //tx, rx via USB connection
 DigitalOut led(LED1);
-MotCon m1(p23, p24, p25);   //uses p23 for pwm and p24 and 35 for direction (complimentary)
+MotCon m1(p23, p24, p25);   //uses p23 for pwm and p24 and p25 for direction (complimentary)
+C12832_LCD lcd;
 
 //------------ Main ------------------------------
 int main() {    
+    wait(.2);       //short delay
+    lcd.cls();
+    lcd.locate(0,0);
+    lcd.printf("SY202 Motor Test");             
+    
     pc.baud(921600);//fast baud rate for USB PC connection
     while(1) {
         //iterate through 2*pi cycles in .01 increments
         for(float cycle=0;cycle<3.14159*2.0;cycle+=.01){
             float m1_dc = .85*sin(cycle);            
             m1.mot_control(m1_dc);                        
-                        
+            
+            lcd.locate(0,8);
+            lcd.printf("cycle=%.2f dc=%7.2f \n", cycle, m1_dc);
+            
+            lcd.locate(0,16);
+            if(m1_dc > 0.001)
+                lcd.printf("Forward\n");
+            else if(m1_dc < 0.001)
+                lcd.printf("Reverse\n");
+                
             pc.printf("cycle=%.3f  m1_dc = %.2f \r\n", cycle, m1_dc);
             wait(.01);      //determines period
             led = !led;     //toggle LED1 to indicate activity