
évitement d obstacles
Dependencies: Motor 16_Channel_Analog VL53L0X
main.cpp
- Committer:
- sylvaingauthier
- Date:
- 2020-07-17
- Revision:
- 1:53b992a47b28
- Parent:
- 0:324dc73a5829
- Child:
- 2:f3ca81bbfabf
File content as of revision 1:53b992a47b28:
/* mbed Microcontroller Library * Copyright (c) 2019 ARM Limited * SPDX-License-Identifier: Apache-2.0 */ #include "mbed.h" #include "perceptron.h" #include "Motor.h" #include <vector> #include <iostream> #include <stdio.h> int main() { Motor m1(D8, D9, D10); // pwm, fwd, rev Motor m2(D3, D4, D5); // pwm, fwd, rev printf("debut\r\n"); vector<float> Wg = {1,1,-1,-1}; perceptron perceptronG(Wg); vector<float> Wd = {1,-1,-1,1}; perceptron perceptronD(Wd); while(true){ vector<int> X = {1,1,1}; printf("X=%d,%d,%d\r\n",X[0],X[1],X[2]); int Vg=perceptronG.predict(X); int Vd=perceptronD.predict(X); printf("Vg=%d\r\n",Vg); printf("Vd=%d\r\n",Vd); m1.speed(Vg); m2.speed(Vd); } }