void setupRadio() { printf_begin(); // Setup and configure radio radio.begin(); radio.setAutoAck(1); // Ensure autoACK is enabled radio.enableAckPayload(); // Allow optional ack payloads radio.setRetries(2,15); // Smallest time between retries, max no. of retries radio.setPayloadSize(8); radio.setDataRate(RF24_250KBPS); if( radio.getDataRate() == RF24_250KBPS ) { debugPrint("Radio is available"); radio_hw_available = true; radio.startListening(); // Start listening radio.powerUp(); radio.openWritingPipe(pipes[0]); // Open different pipes when writing. Write on pipe 0, address 0 radio.openReadingPipe(1,pipes[1]); // Read on pipe 1, as address 1 } else { debugPrint("Radio is NOT available"); } //radio.printDetails(); // Dump the configuration of the rf unit for debugging }
void setup() { #ifdef ARDUINO_ARCH_AVR sleep_setup(); // if you want to use sleep, or use the optiboot watchdog #endif //wdt_disable(); Serial.begin(115200); #ifdef ARDUINO_ARCH_AVR printf_begin(); #endif printf_P(PSTR("HomeMesh 1.0\r\n")); printf_P(PSTR("(c) koverg70 %s %s\r\n"), __DATE__, __TIME__); /* pinMode(LED_PIN, OUTPUT); for (int i=1; i<3; ++i) { digitalWrite(LED_PIN, HIGH); delay(500); digitalWrite(LED_PIN, LOW); delay(500); } */ printf_P(PSTR("NodeID: %d, CE pin: %d, CS pin: %d\r\n"), NODE_ID, NRF24_CE_PIN, NRF24_CS_PIN); // a very simple RF24 radio test delay(500); mesh.setNodeID(NODE_ID); printf_P(PSTR("NodeID: %d, CE pin: %d, CS pin: %d\r\n"), NODE_ID, NRF24_CE_PIN, NRF24_CS_PIN); mesh.begin(); printf_P(PSTR("NodeID: %d, CE pin: %d, CS pin: %d\r\n"), NODE_ID, NRF24_CE_PIN, NRF24_CS_PIN); // --- now we initialize the tasks the are regularily called with new messages and to process information ---- addTask(new TimeSync(60000, 0)); // sync frequency and target node to require time from #if NODE_ID == 0 Master *master = new Master(); addTask(master); // TODO: where to store received data #ifdef ESP8266 addTask(new ESP8266Ntp()); addTask(new ESP8266Web(master->getSensors())); #else // addTask(new Wifi(master->getSensors())); addTask(new Ethernet(master->getSensors())); #endif #else addTask(new Sensors(0)); // the target node to send sensor data to #endif #ifdef SCHEDULE_PIN addTask(new Schedule(SCHEDULE_PIN)); // sync frequency and target node to require time from #endif // ------------------------------------------------------------------------------------------------------------ for (int i = 0; i < taskCount; ++i) { tasks[i]->begin(); printf_P(PSTR("Task started: %s\r\n"), tasks[i]->name()); } }
void setup(void) { //maxa = EEPROM.read(CONFIG_START); //EEPROM.write(CONFIG_START, maxa); lcd.begin (20,4); delay(10); lcd.setBacklightPin(BACKLIGHT,POSITIVE); lcd.setBacklight(HIGH); lcd.clear(); delay(10); lcd.home (); Serial.begin(57600); printf_begin(); radio.begin(); radio.setPALevel(RF24_PA_MAX); //RF24_PA_MIN = 0, RF24_PA_LOW, RF24_PA_HIGH, RF24_PA_MAX, RF24_PA_ERROR radio.setDataRate(RF24_250KBPS); //RF24_1MBPS = 0, RF24_2MBPS, RF24_250KBPS //radio.setAutoAck(1); radio.setRetries(15,15); radio.enableDynamicPayloads(); radio.openWritingPipe(pipes[1]); radio.openReadingPipe(1, pipes[0]); radio.startListening(); radio.printDetails(); }
void print_debug_info() { if (!printf_initialized) { printf_begin(); printf_initialized = 1; } radio.printDetails(); }
void printf_filler() { int blanks = (0x201 - (cout_count % 0x200)); if (blanks > 100 || blanks == 0) return; int i; for (i = 0; i < blanks; i++) { _printf(""); } printf_begin(); }
void setup() { Serial.begin(115200); printf_begin(); Serial.println(F("\n\n** NeoPixelWirelessClient ** \n\n")); Serial.println(F("Reading client configuration....")); if( !readClientConfiguration( (client_configuration_t *)&clientConfig) ) { Serial.println(F("** Error reading client configuration\n")); clientConfig.version = CLIENT_CONFIG_V10; clientConfig.nodeId = 0x01; if( !writeClientConfiguration((client_configuration_t *)&clientConfig) ) { Serial.println(F("** Error writing client configuration\n")); } else { Serial.println(F("Successfully wrote client configuration\n")); } } else { Serial.println(F("Successfully Read Configuration:\n")); } dumpClientConfiguration((client_configuration_t *)&clientConfig); // Setup and configure radio radio.begin(); radio.enableAckPayload(); // enable payload ack radio.enableDynamicPayloads(); // Ack payloads are dynamic payloads setNodeId(clientConfig.nodeId); // radio.openWritingPipe(addresses[1]); // radio.openReadingPipe(1, addresses[0]); // radio.startListening(); // we're the client, so start listening radio.writeAckPayload(1, &message_count, sizeof(message_count)); ++message_count; radio.printDetails(); // Dump the configuration of the rf unit for debugging delay(50); attachInterrupt(0, check_radio, LOW); // Attach interrupt handler to interrupt #0 (using pin 2) on BOTH the sender and receiver if (controller.initialize(50, 2) == false) { } else { controller.fill(CRGB::Black, true); } }
void setup(){ uextPowerOn(); pinMode(LED, OUTPUT); pinMode(OUT, OUTPUT); Serial.begin(115200); printf_begin(); radio.begin(); radio.setCRCLength(RF24_CRC_16); radio.setDataRate(RF24_1MBPS); radio.setAutoAck(0); radio.setRetries(0,0); radio.setPayloadSize(3); radio.powerUp(); radio.printDetails(); setupReceive(); }
void HomeAutomation::begin() { #ifdef HOMEAUTOMATION_DEBUG printf_begin(); #endif this->radio->begin(); this->radio->setRetries(10, 10); this->radio->setChannel(0x4c); this->radio->setDataRate(RF24_250KBPS); this->radio->setPALevel(RF24_PA_HIGH); this->radio->setCRCLength(RF24_CRC_16); this->radio->setAutoAck(true); this->radio->enableDynamicPayloads(); this->radio->enableAckPayload(); this->radio->openWritingPipe(serverAddress); this->radio->openReadingPipe(1, listenAddress); this->radio->startListening(); #ifdef HOMEAUTOMATION_DEBUG this->radio->printDetails(); #endif }
void setup(void) { // // Print preamble // Serial.begin(57600); printf_begin(); printf("\n\rRF24/examples/scanner/\n\r"); // // Setup and configure rf radio // radio.begin(); radio.setAutoAck(false); // Get into standby mode radio.startListening(); radio.stopListening(); // Print out header, high then low digit int i = 0; while ( i < num_channels ) { printf("%x",i>>4); ++i; } printf("\n\r"); i = 0; while ( i < num_channels ) { printf("%x",i&0xf); ++i; } printf("\n\r"); }
void cmd_start() { printf_begin(); }
void setup(void) { // // Announce // Serial.begin(57600); printf_begin(); printf_P(PSTR("\n\rTheCameraMachine - [email protected]\n\r")); printf_P(PSTR("VER. %s\n\r"),program_version); printf_P(PSTR("FREE %u\n\r"),freeMemory()); // // Pin Symbols // #if NATIVE pinSymbol(test_switch_pin,"test_switch"); pinSymbol(other_led_pin,"other_led"); pinSymbol(power_led_pin,"power_led"); pinSymbol(record_led_pin,"record_led"); #ifdef HAVE_RELAYS pinSymbol(power_relay_pin,"power_relay"); pinSymbol(alt_relay_pin,"alt_relay"); #endif #ifdef HAVE_LANC pinSymbol(lanc_rx_pin,"lanc_rx"); pinSymbol(lanc_tx_pin,"lanc_tx"); #endif #ifdef HAVE_FOCUS_SHUTTER pinSymbol(focus_pin,"focus"); pinSymbol(shutter_pin,"shutter"); #endif #ifdef HAVE_PIEZO pinSymbol(piezo_pin,"piezo"); #endif #ifdef HAVE_RECORD_BUTTON pinSymbol(record_button_pin,"record_button"); #endif #endif // if NATIVE // // Begin objects // rtc_begin(); test_switch.begin(up); power_led.begin(NULL); record_led.begin(NULL); other_led.begin(NULL); tty.begin(up); #ifdef HAVE_FOCUS_SHUTTER focus.begin(NULL); shutter_tap.begin(up,NULL); #endif #ifdef HAVE_RELAYS power_relay.begin(NULL); alt_relay.begin(NULL); #endif #ifdef HAVE_RECORD_BUTTON record_button.begin(up); #endif #ifdef HAVE_LANC camera.begin(NULL); // Un-comment this to try multiple record pulses if needed for a certain // camera //camera.setRecordPulses(2); #endif #ifdef HAVE_FIRE_CAMERA fire_camera.begin(up,NULL); #endif #ifdef HAVE_START_STOP_RECORD_SEQ start_record.begin(up,NULL); stop_record.begin(up,NULL); #endif // // Logger symbols // logger.setSymbol(signal_power_on, PSTR("power_on")); logger.setSymbol(signal_power_off, PSTR("power_off")); logger.setSymbol(signal_start_record, PSTR("start_record")); logger.setSymbol(signal_stop_record, PSTR("stop_record")); logger.setSymbol(signal_alt_relay_on, PSTR("alt_relay_on")); logger.setSymbol(signal_alt_relay_off, PSTR("alt_relay_off")); logger.setSymbol(signal_other_led_on, PSTR("other_led_on")); logger.setSymbol(signal_other_led_off, PSTR("other_led_off")); logger.setSymbol(signal_toggle_record, PSTR("toggle_record")); logger.setSymbol(signal_fire_camera, PSTR("fire_camera")); logger.setSymbol(signal_focus_on, PSTR("focus_on")); logger.setSymbol(signal_focus_off, PSTR("focus_off")); logger.setSymbol(signal_shutter_tap, PSTR("shutter_tap")); logger.setSymbol(signal_power_relay_on, PSTR("power_relay_on")); logger.setSymbol(signal_power_relay_off, PSTR("power_relay_off")); logger.setSymbol(&test_switch, PSTR("test_switch")); logger.setSymbol(&power_led, PSTR("power_led")); logger.setSymbol(&record_led, PSTR("record_led")); logger.setSymbol(&other_led, PSTR("other_led")); logger.setSymbol(events.channel(0), PSTR("events ch#0")); #ifdef HAVE_FOCUS_SHUTTER logger.setSymbol(&focus, PSTR("focus")); logger.setSymbol(&shutter_tap, PSTR("shutter_tap")); #endif #ifdef HAVE_RELAYS logger.setSymbol(&power_relay, PSTR("power_relay")); logger.setSymbol(&alt_relay, PSTR("alt_relay")); #endif #ifdef HAVE_RECORD_BUTTON logger.setSymbol(&record_button, PSTR("record_button")); #endif #ifdef HAVE_LANC logger.setSymbol(&camera, PSTR("camera")); #endif #ifdef HAVE_FIRE_CAMERA logger.setSymbol(&fire_camera, PSTR("fire_camera")); logger.setSymbol(fire_camera.channel(0), PSTR("fire_camera ch#0")); #endif #ifdef HAVE_START_STOP_RECORD_SEQ logger.setSymbol(&start_record, PSTR("start_record")); logger.setSymbol(start_record.channel(0), PSTR("start_record ch#0")); logger.setSymbol(&stop_record, PSTR("stop_record")); logger.setSymbol(stop_record.channel(0), PSTR("stop_record ch#0")); #endif // Begin the logger after all the symbols are set. logger.begin(); events.begin(); conn.setLogger(&logger); // Begin the main events after the logger is set up events.begin(up); }