Jeden void pro více různých periferií

Wiring, C++, C, Java, ...
Pravidla fóra
Toto subfórum slouží k řešení obecných otázek kolem programování (konstrukce, knihovny, alokace paměti, ...)
Bart_
Příspěvky: 18
Registrován: 06 srp 2019, 23:24
Reputation: 0

Re: Jeden void pro více různých periferií

Příspěvek od Bart_ » 24 lis 2019, 23:15

Dobře, chybu jsem si našel..
Mělo to tam být bez int (u Stepper), takto:

Kód: Vybrat vše

MujMotor::MujMotor(int a, int b, int c, int d, int e):Stepper(number_of_steps, motor_pin_1, motor_pin_2, motor_pin_3, motor_pin_4){
  
}
Ale teď narážím na jiný problém. Number_of_steps a další jsou private.
C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.21.0_x86__mdqgnx93n4wtt\libraries\Stepper\src/Stepper.h: In constructor 'MujMotor::MujMotor(int, int, int, int, int)':

C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.21.0_x86__mdqgnx93n4wtt\libraries\Stepper\src/Stepper.h:106:9: error: 'int Stepper::number_of_steps' is private

int number_of_steps; // total number of steps this motor can take

^

sketch_nov24c:18:63: error: within this context

MujMotor::MujMotor(int a, int b, int c, int d, int e):Stepper(number_of_steps, motor_pin_1, motor_pin_2, motor_pin_3, motor_pin_4){

^

In file included from C:\Users\bartv\AppData\Local\Temp\arduino_modified_sketch_4856\sketch_nov24c.ino:1:0:

C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.21.0_x86__mdqgnx93n4wtt\libraries\Stepper\src/Stepper.h:111:9: error: 'int Stepper::motor_pin_1' is private

int motor_pin_1;

^

sketch_nov24c:18:80: error: within this context

MujMotor::MujMotor(int a, int b, int c, int d, int e):Stepper(number_of_steps, motor_pin_1, motor_pin_2, motor_pin_3, motor_pin_4){

^

In file included from C:\Users\bartv\AppData\Local\Temp\arduino_modified_sketch_4856\sketch_nov24c.ino:1:0:

C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.21.0_x86__mdqgnx93n4wtt\libraries\Stepper\src/Stepper.h:112:9: error: 'int Stepper::motor_pin_2' is private

int motor_pin_2;

^

sketch_nov24c:18:93: error: within this context

MujMotor::MujMotor(int a, int b, int c, int d, int e):Stepper(number_of_steps, motor_pin_1, motor_pin_2, motor_pin_3, motor_pin_4){

^

In file included from C:\Users\bartv\AppData\Local\Temp\arduino_modified_sketch_4856\sketch_nov24c.ino:1:0:

C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.21.0_x86__mdqgnx93n4wtt\libraries\Stepper\src/Stepper.h:113:9: error: 'int Stepper::motor_pin_3' is private

int motor_pin_3;

^

sketch_nov24c:18:106: error: within this context

MujMotor::MujMotor(int a, int b, int c, int d, int e):Stepper(number_of_steps, motor_pin_1, motor_pin_2, motor_pin_3, motor_pin_4){

^

In file included from C:\Users\bartv\AppData\Local\Temp\arduino_modified_sketch_4856\sketch_nov24c.ino:1:0:

C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.21.0_x86__mdqgnx93n4wtt\libraries\Stepper\src/Stepper.h:114:9: error: 'int Stepper::motor_pin_4' is private

int motor_pin_4;

^

sketch_nov24c:18:119: error: within this context

MujMotor::MujMotor(int a, int b, int c, int d, int e):Stepper(number_of_steps, motor_pin_1, motor_pin_2, motor_pin_3, motor_pin_4){

^

exit status 1
within this context
EDIT: tak i tuhletu mám :)
správně to bylo takto:

Kód: Vybrat vše

MujMotor::MujMotor(int number_of_steps, int motor_pin_1, int motor_pin_2, int motor_pin_3, int motor_pin_4):Stepper(number_of_steps, motor_pin_1, motor_pin_2, motor_pin_3, motor_pin_4){
  
}

Odpovědět

Kdo je online

Uživatelé prohlížející si toto fórum: Žádní registrovaní uživatelé a 13 hostů