Program to configure the btbee chip on an m3pi over AT commands. Note that the AT hardware switch must be in the AT position for this to work.

Dependencies:   m3pi_ng configure_btbee mbed

Dependents:   configure_btbee

Fork of configure_btbee by Nikolas Goldin

1_main_fh_v2/main.cpp

Committer:
friedrich_h
Date:
2016-07-31
Revision:
6:8c107c6b3433
Parent:
5:dfe78f25fef8

File content as of revision 6:8c107c6b3433:


#include "mbed.h"
#include "m3pi_ng.h"


#define SPEED 0.1

#define W_KEY 1
#define A_KEY 2
#define S_KEY 4
#define D_KEY 8
#define R_KEY 16
           
m3pi myM3pi;


// DigitalOut, DigitalIn, Timer: aus mbed.h
DigitalOut mbed_led[] = {(LED1), (LED2),(LED3), (LED4)};                            
DigitalOut m3pi_led[] = {(p13), (p14), (p15), (p16), (p17), (p18), (p19), (p20)};   // leds oben: p13-p20 (S. 13, M3PI UG)

//DigitalIn: Input-Objekt, welches mit dem Knopf p21 betätigt wird
DigitalIn m3pi_pb(p21);     
                                                         
//create array for sensors
int raw[5];                                                         
 
//create array for sensors
int cal[5];

int main()
{
    

    
     
   // Lichter initialisieren
    for (int i = 0; i <4; i++) {
       mbed_led[i] = 0;
    }
    for (int i = 0; i <8; i++) {
        m3pi_led[i]=0;
    }
  
    
 
   
   // Battery Status:
    myM3pi.locate(0,0);
    myM3pi.printf("B:%0.3f%V",myM3pi.battery());
    
    wait(0.5);
    
//    myM3pi.sensor_auto_calibrate();
    
    
    
    
    
    while (true) {
            
    //Initialize sensors to the array
   
        myM3pi.cls();
    for (int i = 0; i < 5; i++){
        for(int j=0; j<3; j++){
            myM3pi.raw_sensor(raw);
            myM3pi.calibrated_sensor(cal);
            myM3pi.locate(0,0);
            myM3pi.printf("r%d: %d",i, raw[i]);
            myM3pi.locate(0,1);
            myM3pi.printf("c%d: %d",i, cal[i]);
            wait(.5);
            }
            wait(.5);
        }
    
        
        myM3pi.cls();
        for(int j=0; j<10; j++){
            myM3pi.locate(0,0);
        myM3pi.printf("L: %1.2f", myM3pi.line_position());
        wait(.5);
        }
    } // while true
     
}