nBot 'MeDCMotor' does not name a type - Wersja do druku +- Arduino Polska Forum (https://forum.arduinopolska.pl) +-- Dział: Korzystanie z Arduino (https://forum.arduinopolska.pl/dzial-korzystanie-z-arduino) +--- Dział: Programowanie w Arduino (https://forum.arduinopolska.pl/dzial-programowanie-w-arduino) +--- Wątek: nBot 'MeDCMotor' does not name a type (/watek-nbot-medcmotor-does-not-name-a-type) |
nBot 'MeDCMotor' does not name a type - robo1973 - 23-10-2019 Witam !!!! Nie mogę wgrać oprogramowania do mBota #include <Arduino.h> #include <Wire.h> #include <SoftwareSerial.h> MeDCMotor motor_9(9); MeDCMotor motor_10(10); void move(int direction, int speed) { int leftSpeed = 0; int rightSpeed = 0; if(direction == 1){ leftSpeed = speed; rightSpeed = speed; }else if(direction == 2){ leftSpeed = -speed; rightSpeed = -speed; }else if(direction == 3){ leftSpeed = -speed; rightSpeed = speed; }else if(direction == 4){ leftSpeed = speed; rightSpeed = -speed; } motor_9.run((9)==M1?-(leftSpeed)leftSpeed)); motor_10.run((10)==M1?-(rightSpeed)rightSpeed)); } double angle_rad = PI/180.0; double angle_deg = 180.0/PI; double speed; double temp; MeLineFollower linefollower_2(2); MeLEDMatrix ledMtx_4(4); void setup(){ ledMtx_4.setColorIndex(1); ledMtx_4.setBrightness(6); speed = 80; } void loop(){ temp = linefollower_2.readSensors(); if(((temp)==(0))){ move(1,speed); }else{ if(((temp)==(1))){ move(3,speed); }else{ if(((temp)==(2))){ move(4,speed); }else{ move(2,speed); } } } ledMtx_4.showNum(linefollower_2.readSensors(),3); _loop(); } void _delay(float seconds){ long endTime = millis() + seconds * 1000; while(millis() < endTime)_loop(); } void _loop(){ } )\mBlock\Arduino\hardware\arduino\avr\cores\arduino -IC:\Program Files (x86)\mBlock\Arduino\hardware\arduino\avr\variants\standard -IC:\Program Files (x86)\mBlock\Arduino\hardware\arduino\avr\libraries\Wire -IC:\Program Files (x86)\mBlock\Arduino\hardware\arduino\avr\libraries\SoftwareSerial C:\Users\ROBO\AppData\Local\Temp\build649003777677890251.tmp\project_czujnik_lini9_3.cpp -o C:\Users\ROBO\AppData\Local\Temp\build649003777677890251.tmp\project_czujnik_lini9_3.cpp.o project_czujnik_lini9_3.ino:6:1: error: 'MeDCMotor' does not name a type project_czujnik_lini9_3.ino:7:1: error: 'MeDCMotor' does not name a type project_czujnik_lini9_3.ino: In function 'void move(int, int)': project_czujnik_lini9_3.ino:26:7: error: 'motor_9' was not declared in this scope project_czujnik_lini9_3.ino:26:24: error: 'M1' was not declared in this scope project_czujnik_lini9_3.ino:27:7: error: 'motor_10' was not declared in this scope project_czujnik_lini9_3.ino: At global scope: project_czujnik_lini9_3.ino:34:1: error: 'MeLineFollower' does not name a type project_czujnik_lini9_3.ino:35:1: error: 'MeLEDMatrix' does not name a type project_czujnik_lini9_3.ino: In function 'void setup()': project_czujnik_lini9_3.ino:40:5: error: 'ledMtx_4' was not declared in this scope project_czujnik_lini9_3.ino: In function 'void loop()': project_czujnik_lini9_3.ino:48:12: error: 'linefollower_2' was not declared in this scope project_czujnik_lini9_3.ino:62:5: error: 'ledMtx_4' was not declared in this scope 'MeDCMotor' does not name a type RE: nBot 'MeDCMotor' does not name a type - Jarewa0606 - 24-10-2019 Na takim poziomie wiedzy, myślę że w ogóle nie dasz rady.. A rozwiązanie jest w błędach.. |