![]() |
Forum Index : Microcontroller and PC projects : serial input
![]() ![]() |
|||||
Author | Message | ||||
georgestheking Newbie ![]() Joined: 21/12/2021 Location: BelgiumPosts: 32 |
Hi, Thanks everybody for your help and messages. I will add a microcontroller before the Pïcomite to reduce the flux of datas. This project is a two wheels mobile robot for my child. It use a "PID 4 motors controller" from Yahboom. I think BASIC is a good way to learn programming. https://category.yahboom.net/fr/collections/a-motor/products/quad-md-module Best regards Georges Edited 2025-06-12 02:31 by georgestheking |
||||
lizby Guru ![]() Joined: 17/05/2016 Location: United StatesPosts: 3339 |
This seems counter to all of the suggestions made. Have you tried any of the code examples provided? What have the results been? What is your baud rate and what amount of data? You've seen testimony of successful receipt at a baud rate approaching a million bits per second. What convinces you that you will not achieve similar success in your circumstances? PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on fruitoftheshed |
||||
PhenixRising Guru ![]() Joined: 07/11/2023 Location: United KingdomPosts: 1285 |
Yeah,I checked out the Yahboom product and fail to see a problem for the PioMite. Could even outperform the Yahboom servo controller. We can handle eight PIDs and read eight encoders, even on the RP2040. |
||||
toml_12953 Guru ![]() Joined: 13/02/2015 Location: United StatesPosts: 414 |
The following might explain the situation. OPEN "COM1:115200" as #1 When the serial port is opened, the receive buffer is cleared. IF LOC(#1) > 10 THEN data$ = INPUT$(256, #1) Now we check the buffer, which is empty, so data$ is also empty. So we need to wait for the data to arrive: OPEN "COM1:115200" as #1 Do while LOC(#1)<10 ' loop here until 10 chars in input buffer Loop data$ = INPUT$(255, #1) print data$ You can also use interrupts but hopefully this will help. Regards, Lyle. INPUT$(n,#c) will wait until n characters have arrived from channel #c won't it? |
||||
phil99![]() Guru ![]() Joined: 11/02/2018 Location: AustraliaPosts: 2537 |
Will return a string composed of ‘nbr’ characters read from a file or serial communications port opened as 'fnbr'. This function will return as many characters as are in the file or receive buffer up to ‘nbr’. If there are no characters available it will immediately return with an empty string. #0 can be used which refers to the console's input buffer. The # is optional. Also see the OPEN command. The manual could be changed to read " This function will return as many characters as are in the file or receive buffer up to ‘nbr’, removing them from the buffer." If there are more than n characters in the buffer the rest remain and Loc(#x) is adjusted. In my previous program changing 255 to 11 (g$ = Input$(11,#1)) shows this. > LIST ' Serial Rx test program on Pico B SetPin gp1,gp0, com1 : Open "COM1:115200" As #1 g$ = Input$(255,#1) : g$="" 'purge the Rx buffer Do Do While Loc(#1) = 0 : Loop 'wait for data to start arriving Pause 2 'allow time for the rest if the message to arrive 'increase for longer message or lower baud rate Print Loc(#1); " Bytes in Rx buffer", g$ = Input$(11,#1) Print g$; Loop > > RUN 21 Bytes in Rx buffer 12-06-2025 10 Bytes in Rx buffer 11:02:15 21 Bytes in Rx buffer 12-06-2025 10 Bytes in Rx buffer 11:02:16 21 Bytes in Rx buffer 12-06-2025 10 Bytes in Rx buffer 11:02:17 21 Bytes in Rx buffer 12-06-2025 10 Bytes in Rx buffer 11:02:18 21 Bytes in Rx buffer 12-06-2025 10 Bytes in Rx buffer 11:02:19 Edited 2025-06-12 11:25 by phil99 |
||||
![]() ![]() |
![]() |
![]() |
The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |