diff --git a/ueforth/arduino/arduino.template.ino b/ueforth/arduino/arduino.template.ino index a64775a..187b8b7 100644 --- a/ueforth/arduino/arduino.template.ino +++ b/ueforth/arduino/arduino.template.ino @@ -65,6 +65,8 @@ X("SerialBT.disconnect", SERIALBT_DISCONNECT, tos = ((BluetoothSerial *) tos)->disconnect()) \ X("SerialBT.connected", SERIALBT_CONNECTED, tos = ((BluetoothSerial *) tos)->connected(*sp); --sp) \ X("SerialBT.isReady", SERIALBT_IS_READY, tos = ((BluetoothSerial *) tos)->isReady(sp[-1], *sp); sp -= 2) \ + /* Bluetooth */ \ + X("esp_bt_dev_get_address", ESP_BT_DEV_GET_ADDRESS, DUP; tos = (cell_t) esp_bt_dev_get_address()) \ /* Pins and PWM */ \ X("pinMode", PIN_MODE, pinMode(*sp, tos); --sp; DROP) \ X("digitalWrite", DIGITAL_WRITE, digitalWrite(*sp, tos); --sp; DROP) \ diff --git a/ueforth/examples/serialbt.fs b/ueforth/examples/serialbt.fs new file mode 100644 index 0000000..7293f58 --- /dev/null +++ b/ueforth/examples/serialbt.fs @@ -0,0 +1,8 @@ +SerialBT.new constant bt +z" ueforthbt" 0 bt SerialBT.begin . +esp_bt_dev_get_address hex 6 dump cr +: bt-type bt SerialBT.write drop ; +: bt-key + begin bt SerialBT.available until 0 >r rp@ 1 bt SerialBT.readBytes drop r> ; +: bt-on ['] bt-type is type ['] bt-key is key ; +: bt-off ['] arduino-type is type ['] arduino-key is key ; diff --git a/ueforth/site/index.html b/ueforth/site/index.html index 5345aa1..9198c10 100644 --- a/ueforth/site/index.html +++ b/ueforth/site/index.html @@ -169,7 +169,7 @@ Serial.begin ( baud -- ) Start serial port Serial.end ( -- ) End serial port Serial.available ( -- f ) Is serial data available Serial.readBytes ( a n -- n ) Read serial bytes, return number gotten -Serial.write ( a n -- ) Write serial bytes +Serial.write ( a n -- n ) Write serial bytes Serial.flush ( -- ) Flush serial buffer @@ -181,7 +181,7 @@ SerialBT.begin ( localname ismaster bt -- f ) SerialBT.end ( bt -- ) SerialBT.available ( bt -- f ) SerialBT.readBytes ( a n bt -- n ) -SerialBT.write ( a n bt -- ) +SerialBT.write ( a n bt -- n ) SerialBT.flush ( bt -- ) SerialBT.hasClient ( bt -- f ) SerialBT.enableSSP ( bt -- ) @@ -194,6 +194,11 @@ SerialBT.connected ( timeout bt -- f ) SerialBT.isReady ( checkMaster timeout -- f ) Default checkMaster=false, timeout=0 +
Bluetooth
+
+esp_bt_dev_get_address ( -- a ) addr of 6 byte mac address
+
+
GPIO
 pinMode ( pin mode -- )   Set GPIO pin mode