Hello. Exsist an equivalent software serial arduino in ulisp? How to use
"software serial"
Thanks. But my query is how to use a pin’s arduino With a serial port software. No hardware serial usart.
Sorry my english. Is’ very bad
If I understand correctly what you’re asking: uLisp uses the Arduino core’s Serial functions. If these are implemented on a particular platform with software serial it should work in uLisp using with-serial in exactly the same way, even if there’s no hardware usart.
Right. then I redefine the arduino pins in (with-serial (stream port [baud]) form *)
to be able to use 2 serial ports in for example arduino one.
example:
;; PORT 0
(with-serial (str 0 96)
PORT 1
(with-serial (str 1 (10,11) 96)
Do you understand my question?
Thank you. Excellent job.
Yes, you can use different serial ports with the second parameter:
(with-serial (stream port baud) ...
I would like to add a sensor as a fourth serial port device on a Raspberry Pico.
22911> (with-serial (hcho 3 (10,11) 96) (print (read-line hcho)))
yields
Error: ‘with-serial’ too many arguments: (hcho 3 (10,11) 96)
and similarly
22911> (with-serial (hcho 3 96) (print (read-line hcho)))
Error: ‘with-serial’ port not supported: 3
The pico has support for a PIO based emulated UART that is equivalent to the Arduino SoftwareSerial library. The software serial options have disadvantages compared to hardware serial but it is not clear to me yet to what extent such issues also pertain to the PIO-based UART and whether that would practically impact my sensors working together.
If I correctly understand the above answer, if a 4th serial port was implemented with software serial as a part of the Raspberry Pico implementation of the Arduino core’s Serial function, then my second code example would work. However, the Raspberry Pico soft serial is implemented as SerialPIO, from the documentation for the Earl Philhower core :
Instantiate a
SerialPIO(txpin, rxpin, fifosize)
object in your sketch and then use it the same as any other serial port.
The current sensors currently work on the two available hardware UARTs. They have voltage, ground, transmit, and receive ports. I assume that means they are not compatible with I2C or SPI. To get the functionality I have described, would adding SerialPIO as a library to my uLisp installation in addition to the Serial support be necessary and sufficient to solve the problem?
Currently uLisp can support up to four serial ports, Serial, and Serial1 to Serial3.
By default the Raspberry Pi Pico supports up to Serial2; this is configured by the statement in the source:
#elif defined(ARDUINO_RASPBERRY_PI_PICO) || defined(ARDUINO_RASPBERRY_PI_PICO_W)
#define ULISP_SERIAL2
I think if you change the second line to:
#define ULISP_SERIAL3
you’ll be able to use Serial3. However, you’ll also need to activate it in the Raspberry Pi Pico Arduino core. Or you may be able to do it in setup() in the uLisp source.
Let me know how you get on!