Raspberry BASIC > General Discussion
LG Library
John Spikowski:
The tx_pulse.c example.
--- Code: C ---/*tx_pulse.c2020-11-18Public Domain http://abyz.me.uk/lg/lgpio.html gcc -Wall -o tx_pulse tx_pulse.c -llgpio ./tx_pulse*/ #include <stdio.h>#include <stdlib.h> #include <lgpio.h> #define OUT 21#define LOOPS 120 #define LFLAGS 0 int main(int argc, char *argv[]){ int h; int i; double start, end; h = lgGpiochipOpen(0); if (h >= 0) { if (lgGpioClaimOutput(h, LFLAGS, OUT, 0) == LG_OKAY) { lgTxPulse(h, OUT, 20000, 30000, 0, 0); lguSleep(2); lgTxPulse(h, OUT, 20000, 5000, 0, LOOPS); start = lguTime(); while (lgTxBusy(h, OUT, LG_TX_PWM)) lguSleep(0.01); end = lguTime(); printf("%d cycles at 40 Hz took %.1f seconds\n", LOOPS, end-start); } lgGpiochipClose(h); }}
jrs@RPi4B:~/lg/EXAMPLES/lgpio$ sudo ./tx_pulse
120 cycles at 40 Hz took 3.0 seconds
jrs@RPi4B:~/lg/EXAMPLES/lgpio$
John Spikowski:
I created a repository for the lg library on basic-sandbox.us. The only source I know of is from the author's site as a ZIP.
https://basic-sandbox.us/lg/lg-dev
I created a subdomain of RaspberryBASIC.org to host the lg library. The HTML for the site was created by a Python script that comes in the zip distribution.
https://lg.raspberrybasic.org
I feel much better that this public domain open source project won't disappear after spending time building a ScriptBasic extension module around it.
John Spikowski:
I can't seem to get the i2c 1-wire interface going on Ubuntu 64. I was able to get /sys/bus/w1/devices to show up after the modprobe commands but the devices folder is empty. Any advice how to get my DS18B20 to show up?
John Spikowski:
I was able to get access to the DS18B20 using the OWFS interface. Problem is the returned temperature is all over the place. Not sure if this is progress or not. :(
Reading a 1-wire DS18B20 temperature sensor using OWFS
John Spikowski:
I tried the DS18B20 on my RPi 3B under Raspbian and was able to get a valid result, It looks like the OWFS library doesn't work.
pi@RPi3B:~ $ cat /sys/bus/w1/devices/28-041780c226ff/w1_slave
3f 01 4b 46 7f ff 0c 10 f3 : crc=f3 YES
3f 01 4b 46 7f ff 0c 10 f3 t=19937
pi@RPi3B:~ $
From what my research has dug up so far is to get one-wire to work from the kernel a re-link needs to be done. One would think Ubuntu's RPi branch would have already addressed this issue of made it easy like Raspian to enable.
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version