Ich verwende Windows.
Die Hardware:https://asksinpp.de/Grundlagen/01_hardw ... dware.html
Frage A) Hab ich das richtig Verstanden: Man kann einen FTDI Adapter ODER einen Diamex ISP Adapter benutzen. Ich habe mich für den FTDI Adapter entschieden. (Als Anfänger sagt einem FTDI und Diamex erst mal gar nichts. Gibt es eine einfache Erklärung welcher Adapter welche Vor- Nachteile mit sich bringt?
Die Software https://asksinpp.de/Grundlagen/02_softw ... tware.html
Frage B) Hab ich das richtig Verstanden: Ich kann PlatformIO ODER Arduino als Entwicklungsumgebung benutzen. Gibt es eine einfache Erklärung welcher Software welche Vor- Nachteile mit sich bringt?
Frage C) Ich habe den Sketch runtergeladen und in Arduino geöffnet. Bei den Bibliotheken war AskSinPP und EnableInterrupt einfach zu finden. Aber bei Low-Power gibt es viel Auswahl und die von Arduino ist die Erste. Ich hab aber die "Low-Power by Rocket Scream Electronics" verwendet. Passt das?
Frage D) Beim kompilieren kriege ich folgende Fehlermeldung:
Wo und wie soll ich das definieren?HM-RC-P1:70:65: error: 'DoublePressButton' was not declared in this scope
Hier der Quellcode:
Code: Alles auswählen
//- -----------------------------------------------------------------------------------------------------------------------
// AskSin++
// 2017-07-26 papa Creative Commons - http://creativecommons.org/licenses/by-nc-sa/3.0/de/
// ci-test=yes board=328p aes=no
//- -----------------------------------------------------------------------------------------------------------------------
// define this to read the device id, serial and device type from bootloader section
// #define USE_OTA_BOOTLOADER
#define EI_NOTEXTERNAL
#include <EnableInterrupt.h>
#include <LowPower.h>
#include <AskSinPP.h>
#include <MultiChannelDevice.h>
#include <Remote.h>
// Arduino pin for the config button
// B0 == PIN 8
#define CONFIG_BUTTON_PIN 8
// Arduino pins for the buttons
// A0 == PIN 14
#define BTN1_PIN 14
// number of available peers per channel
#define PEERS_PER_CHANNEL 10
// all library classes are placed in the namespace 'as'
using namespace as;
// define all device properties
const struct DeviceInfo PROGMEM devinfo = {
{0x00,0x1a,0x00}, // Device ID
"HMRC001A00", // Device Serial
{0x00,0x1a}, // Device Model
0x11, // Firmware Version
as::DeviceType::Remote, // Device Type
{0x00,0x00} // Info Bytes
};
/**
* Configure the used hardware
*/
typedef AvrSPI<10,11,12,13> SPIType;
typedef Radio<SPIType,2> RadioType;
typedef DualStatusLed<5,4> LedType;
typedef AskSin<LedType,BatterySensor,RadioType> HalType;
class Hal : public HalType {
// extra clock to count button press events
AlarmClock btncounter;
public:
void init (const HMID& id) {
HalType::init(id);
// get new battery value after 50 key press
battery.init(50,btncounter);
battery.low(22);
battery.critical(19);
}
void sendPeer () {
--btncounter;
}
bool runready () {
return HalType::runready() || btncounter.runready();
}
};
typedef RemoteChannel<Hal,PEERS_PER_CHANNEL,List0, RemoteList1, DoublePressButton> ChannelType;
typedef MultiChannelDevice<Hal,ChannelType,1> RemoteType;
Hal hal;
RemoteType sdev(devinfo,0x20);
ConfigButton<RemoteType> cfgBtn(sdev);
void setup () {
DINIT(57600,ASKSIN_PLUS_PLUS_IDENTIFIER);
sdev.init(hal);
remoteISR(sdev,1,BTN1_PIN);
buttonISR(cfgBtn,CONFIG_BUTTON_PIN);
sdev.initDone();
}
void loop() {
bool worked = hal.runready();
bool poll = sdev.pollRadio();
if( worked == false && poll == false ) {
hal.activity.savePower<Sleep<>>(hal);
}
}