Michal88 Napisano Styczeń 1, 2025 Udostępnij Napisano Styczeń 1, 2025 Próbuje szkicu z arduino IDE, ale mam małe problemy. // Copyright 2024 Espressif Systems (Shanghai) PTE LTD // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. /** * @brief This example demonstrates Zigbee Network Scanning. * * The example demonstrates how to use ESP Zigbee stack to scan for Zigbee networks. * * Any Zigbee mode can be selected in Tools->Zigbee mode * with proper Zigbee partition scheme in Tools->Partition Scheme. * * Please check the README.md for instructions and more detailed description. * * Created by Jan Procházka (https://github.com/P-R-O-C-H-Y/) */ #if !defined(ZIGBEE_MODE_ED) && !defined(ZIGBEE_MODE_ZCZR) #error "Zigbee device mode is not selected in Tools->Zigbee mode" #endif #include "Zigbee.h" #ifdef ZIGBEE_MODE_ZCZR zigbee_role_t role = ZIGBEE_ROUTER; // or can be ZIGBEE_COORDINATOR, but it won't scan itself #else zigbee_role_t role = ZIGBEE_END_DEVICE; #endif void printScannedNetworks(uint16_t networksFound) { if (networksFound == 0) { Serial.println("No networks found"); } else { zigbee_scan_result_t *scan_result = Zigbee.getScanResult(); Serial.println("\nScan done"); Serial.print(networksFound); Serial.println(" networks found:"); Serial.println("Nr | PAN ID | CH | Permit Joining | Router Capacity | End Device Capacity | Extended PAN ID"); for (int i = 0; i < networksFound; ++i) { // Print all available info for each network found Serial.printf("%2d", i + 1); Serial.print(" | "); Serial.printf("0x%04hx", scan_result[i].short_pan_id); Serial.print(" | "); Serial.printf("%2d", scan_result[i].logic_channel); Serial.print(" | "); Serial.printf("%-14.14s", scan_result[i].permit_joining ? "Yes" : "No"); Serial.print(" | "); Serial.printf("%-15.15s", scan_result[i].router_capacity ? "Yes" : "No"); Serial.print(" | "); Serial.printf("%-19.19s", scan_result[i].end_device_capacity ? "Yes" : "No"); Serial.print(" | "); Serial.printf( "%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x", scan_result[i].extended_pan_id[7], scan_result[i].extended_pan_id[6], scan_result[i].extended_pan_id[5], scan_result[i].extended_pan_id[4], scan_result[i].extended_pan_id[3], scan_result[i].extended_pan_id[2], scan_result[i].extended_pan_id[1], scan_result[i].extended_pan_id[0] ); Serial.println(); delay(10); } Serial.println(""); // Delete the scan result to free memory for code below. Zigbee.scanDelete(); } } void setup() { Serial.begin(115200); // Initialize Zigbee stack without any EPs just for scanning if (!Zigbee.begin(role)) { Serial.println("Zigbee failed to start!"); Serial.println("Rebooting..."); ESP.restart(); } Serial.println("Setup done, starting Zigbee network scan..."); // Start Zigbee Network Scan with default parameters (all channels, scan time 5) Zigbee.scanNetworks(); } void loop() { // check Zigbee Network Scan process int16_t ZigbeeScanStatus = Zigbee.scanComplete(); if (ZigbeeScanStatus < 0) { // it is busy scanning or got an error if (ZigbeeScanStatus == ZB_SCAN_FAILED) { Serial.println("Zigbee scan has failed. Starting again."); Zigbee.scanNetworks(); } // other option is status ZB_SCAN_RUNNING - just wait. } else { // Found Zero or more Wireless Networks printScannedNetworks(ZigbeeScanStatus); Zigbee.scanNetworks(); // start over... } // Loop can do something else... delay(500); Serial.println("Loop running..."); } 15:24:37.512 -> !���BJJ E��!!�!�!�()_H��� 15:24:37.512 -> (!()��!!� 15:24:37.512 -> ʡJH!0$���� 15:24:37.512 -> �!�!�!�Z�!�!��ħ�!�!�!F��!�1e��1�)]�!!�!��!!)!�!k�!�1�1F1��!!!!�!�!B�!)!Z���!���!��!��!��!��!!��!�!!!�J�!�!�!��!�1�!B1�!�1��!�!�Z��H�����!!!�!�J�!��!)!�!!)!��!��!�!�!�1g!�!�!�!�!�!!��!�����!��!�!�!�1G!�H�!�F�c��i 15:24:37.899 -> �Ϲ�H��N��i)����H�1�� 15:24:38.353 ->
Michal88 Styczeń 1, 2025 Autor tematu Udostępnij Styczeń 1, 2025 Linka do czego to jest przykład, z arduino ide
orb777 Styczeń 1, 2025 Udostępnij Styczeń 1, 2025 A jaki masz baud w konsoli arduino ustawiony? W kodzie jest: Serial.begin(115200); 1 1
Michal88 Styczeń 2, 2025 Autor tematu Udostępnij Styczeń 2, 2025 (edytowany) 19:19:14.855 -> mode:DIO, clock div:2 19:19:14.855 -> load:0x40875720,len:0x1228 19:19:14.855 -> load:0x4086c110,len:0xd9c 19:19:14.855 -> load:0x4086e610,len:0x2f74 19:19:14.855 -> entry 0x4086c110 19:19:15.081 -> Guru Meditation Error: Core 0 panic'ed (Load access fault). Exception was unhandled. 19:19:15.146 -> 19:19:15.821 -> ESP-ROM:esp32c6-20220919 19:19:15.853 -> Build:Sep 19 2022 19:19:15.853 -> rst:0xc (SW_CPU),boot:0xc (SPI_FAST_FLASH_BOOT) 19:19:15.853 -> Saved PC:0x4001975a 19:19:15.853 -> SPIWP:0xee 19:19:15.853 -> mode:DIO, clock div:2 22 godziny temu, orb777 napisał: A jaki masz baud w konsoli arduino ustawiony? W kodzie jest: Serial.begin(115200); Dzięki już działa. Edytowano Styczeń 2, 2025 przez Michal88 1
Pomocna odpowiedź
Bądź aktywny - zaloguj się lub utwórz konto!
Tylko zarejestrowani użytkownicy mogą komentować zawartość tej strony
Utwórz konto w ~20 sekund!
Zarejestruj nowe konto, to proste!
Zarejestruj się »Zaloguj się
Posiadasz własne konto? Użyj go!
Zaloguj się »