TomMajor / SmartHome

Various SmartHome projects, devices, information and examples including AskSinPP usage
86 stars 28 forks source link

tmBattery.h #27

Closed Luckysnooze closed 4 years ago

Luckysnooze commented 4 years ago

Hallo! Ich benutze den HB-UNI-Sensor1 mit Step-Up Spannungsversorgung. In der CFG ist #define BAT_SENSOR tmBatteryResDiv<A0, 9, 5700> ausgewählt,

beim Kompilieren der HB-UNI-Sensor1.ino bekomme ich folgende Fehlermeldung:

Arduino: 1.8.9 (Windows 10), Board: "ATmega328, Yes, 328P / 328PA, 2.7v, Disabled (default), 8 MHz internal"

In file included from D:\Backup\Arduino\HB-UNI-Sensor1\HB-UNI-Sensor1.ino:30:0: sketch\Sensors/tmBattery.h: In member function 'virtual uint16_t as::tmBatteryResDiv<SENSPIN, ACTIVATIONPIN, FACTOR>::voltage()':

sketch\Sensors/tmBattery.h:172:30: error: 'PIN_A0' was not declared in this scope

     ADMUX |= ((SENSPIN - PIN_A0) & 0x0F);    // select SensePin as input

                          ^~~~~~

sketch\Sensors/tmBattery.h:172:30: note: suggested alternative: 'PIN0'

     ADMUX |= ((SENSPIN - PIN_A0) & 0x0F);    // select SensePin as input

                          ^~~~~~

                          PIN0

sketch\Sensors/tmBattery.h: In member function 'virtual uint16_t as::tmBatteryLoad<SENSPIN, ACTIVATIONPIN, FACTOR, LOADTIME>::voltage()':

sketch\Sensors/tmBattery.h:224:30: error: 'PIN_A0' was not declared in this scope

     ADMUX |= ((SENSPIN - PIN_A0) & 0x0F);    // select SensePin as input

                          ^~~~~~

sketch\Sensors/tmBattery.h:224:30: note: suggested alternative: 'PIN0'

     ADMUX |= ((SENSPIN - PIN_A0) & 0x0F);    // select SensePin as input

                          ^~~~~~

                          PIN0

exit status 1

TomMajor commented 4 years ago

PIN_A0 ist ein Standard Arduino define. Dein Boardtyp 'ATmega328' sagt mir nichts. Probiere es mal mit dem Boardtyp 'Arduino Pro or Pro Mini'

Luckysnooze commented 4 years ago

Das Board ist ein Pro Mini (mit MiniCore Bootloader). Hab jetzt statt Pin_A0 mal A0 benutzt und nun funktioniert es :-)

Danke für die Antwort und dieses Projekt!

TomMajor commented 4 years ago

ja gerne. Wenn es ein Pro Mini ist sollte man auch diesen als Board auswählen und dann sollte auch PIN_A0 definiert sein, oder?