You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/Scripting-Language.md
+16-6Lines changed: 16 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -584,12 +584,16 @@ If a Tasmota `SENSOR` or `STATUS` or `RESULT` message is not generated or a `Var
584
584
`sf(F)` = sets the CPU Frequency (ESP32) to 80,160,240 Mhz, returns current Freq.
585
585
`s(x)` = explicit conversion from number x to string may be preceded by precision digits e.g. s(2.2x) = use 2 digits before and after decimal point
586
586
587
-
I2C support #define USE_SCRIPT_I2C
587
+
### I2C support
588
+
589
+
`#define USE_SCRIPT_I2C`
588
590
`ia(AA)`, `ia2(AA)` test and set I2C device with address AA (on BUS 1 or 2), returns 1 if device is present
589
591
`iw(aa val)` , `iw1(aa val)`, `iw2(aa val)`, `iw3(aa val) `write val to register aa (1..3 bytes), if in aa bit 15 is set no destination register is transfered (needed for some devices), if bit 14 is set byte order is reversed
590
592
`ir(aa)`, `ir1(aa)`, `ir2(aa)`, `ir3(aa)` read 1..3 bytes from register aa
591
593
592
-
Onewire support #define USE_SCRIPT_ONEWIRE
594
+
### Onewire support
595
+
596
+
`#define USE_SCRIPT_ONEWIRE`
593
597
support for onewire either directly or via serial port with onewire bus driver DS2480B
594
598
`ow(SEL <opt PAR>)`
595
599
SEL 0 = init bus with pin number N (if bit 15 ist set, select serial DS2480B, lsb = rec pin, msb = trx pin)
@@ -605,7 +609,9 @@ support for onewire either directly or via serial port with onewire bus driver D
605
609
SEL 10-18 = get byte (1-8) of adress from index PAR
606
610
SEL 99 = delete bus driver
607
611
608
-
Serial IO support #define USE_SCRIPT_SERIAL
612
+
### Serial IO support
613
+
614
+
`#define USE_SCRIPT_SERIAL `
609
615
`so(RXPIN TXPIN BR)` open serial port with RXPIN, TXPIN and baud rate BR with 8N1 serial mode (-1 for pin means don't use)
610
616
`so(RXPIN TXPIN BR MMM)` open serial port with RXPIN, TXPIN and baud rate BR and serial mode e.g 7E2 (all 3 modechars must be specified)
611
617
`so(RXPIN TXPIN BR MMM BSIZ)` open serial port with RXPIN, TXPIN and baud rate BR and serial mode e.g 7E2 (all 3 modechars must be specified) and serial IRW buffer size
@@ -623,14 +629,18 @@ Serial IO support #define USE_SCRIPT_SERIAL
623
629
`swa(ARRAY len (flags))` send len bytes of an array to serial port, if flags is set Modbus cmd is assumed and cksum is calculated, 0 = standard Modbus, 1 = Rec BMA mode
624
630
`smw(ADDR MODE NUMBER)` send a value with checksum to MODBUS Address, MODE 0 = uint16, 1 = uint32, 3 = float
625
631
626
-
SPI IO support #define `USE_SCRIPT_SPI`
632
+
### SPI IO support
633
+
634
+
`#define USE_SCRIPT_SPI`
627
635
`spi(0 SCLK MOSI MISO)` defines a software SPI port with pin numbers used for SCLK, MOSI, MISO.
628
636
`spi(0 -1 freq)` defines a hardware SPI port with pin numbers defined by Tasmota GPIO definition with bus frequency in Mhz.
629
637
`spi(0 -2 freq)` defines a hardware SPI port 2 on ESP32 with pin numbers defined by Tasmota GPIO definition.
630
638
`spi(1 N GPIO)` sets the CS pin with index N (1..4) to pin Nr GPIO.
631
639
`spi(2 N ARRAY LEN S)` sends and receives an ARRAY with LEN values with S (1..3) (8,16,24 bits) if N==-1 CS is ignored. If S=4, CS is raised after each byte.
632
640
633
-
TCP server support #define `USE_SCRIPT_TCP_SERVER`
641
+
### TCP server support
642
+
643
+
`#define USE_SCRIPT_TCP_SERVER`
634
644
`wso(port)` start a tcp stream server at port
635
645
`wsc()` close tcp stream server
636
646
`wsa()` return bytes available on tcp stream
@@ -710,7 +720,7 @@ The following variables are cleared after reading true:
0 commit comments