@@ -22,12 +22,12 @@ Notes on Arduino libraries and sketches and other related stuff.
2222 * [ Sipeed Longan Nano RISC-V proto board (GD32VF103CBT6)] ( #sipeed-longan-nano-risc-v-proto-board-gd32vf103cbt6 )
2323 * [ DFU mode] ( #dfu-mode )
2424 * [ Upload demo sketch] ( #upload-demo-sketch )
25- * [ TODO] ( #todo )
2625 * [ Raspberry Pi HDMI LCD display (800x480, 4")] ( #raspberry-pi-hdmi-lcd-display-800x480-4 )
2726 * [ Raspberry Pi Pico (RP2040)] ( #raspberry-pi-pico-rp2040 )
2827 * [ PCA9685 driver board] ( #pca9685-driver-board )
2928 * [ MP3 Modules] ( #mp3-modules )
3029 * [ VS1053 notes] ( #vs1053-notes )
30+ * [ Bosch BMP280] ( #bosch-bmp280 )
3131* [ Misc] ( #misc )
3232 * [ WS2812 protection circuit] ( #ws2812-protection-circuit )
3333* [ Author] ( #author )
@@ -40,7 +40,7 @@ Notes on Arduino libraries and sketches and other related stuff.
4040
4141JLed is an Arduino library to control LEDs. It uses a non-blocking approach and
4242can control LEDs in simple (on/off) and complex (blinking, breathing) ways in a
43- time-driven manner.
43+ time-driven manner. It's available as a C++ or Python lib.
4444
4545<img alt =" jled " width =256 src =" images/jled.gif " >
4646
@@ -56,7 +56,21 @@ void loop() {
5656 led_breathe.Update();
5757}
5858```
59+
60+ The Python API mirrors the C++ API:
61+
62+ ``` python
63+ import board
64+ from jled import JLed
65+
66+ led = JLed(board.LED ).blink(500 , 500 ).forever()
67+
68+ while True :
69+ led.update()
70+ ```
71+
5972* https://github.com/jandelgado/jled
73+ * https://github.com/jandelgado/jled-circuitpython
6074
6175### log4arduino
6276
@@ -277,7 +291,7 @@ dfu-util: dfuse_download: libusb_control_transfer returned -1
277291If the demo sketch works, you should now see the builtin LEDs cycle in colors
278292red, green and blue.
279293
280- #### TODO
294+ TODO
281295
282296- [ ] LCD demo w/ arduino framework
283297- [ ] JLed demo
@@ -429,6 +443,62 @@ Libraries and examples:
429443* https://github.com/adafruit/Adafruit_VS1053_Library
430444* https://github.com/madsci1016/Sparkfun-MP3-Player-Shield-Arduino-Library
431445
446+ ### Bosch BMP280
447+
448+ <img src="images/bmp280.png" width="500" alt="bmp280">
449+
450+ The [Bosch
451+ BMP280](https://www.bosch-sensortec.com/products/environmental-sensors/pressure-sensors/bmp280/)
452+ is an environmental sensor, capable of measuring temperature and barometric air
453+ Pressure. The sensor supports both I²C and SPI. There are many different
454+ boards available, mine is labeled `GY-BME/PM280` and costs about 1.60€
455+ (02/2023). I successfully connected it using I²C and CircuitPython, running on
456+ an Raspberry Pi Pico W using the
457+ [adafruit_bmp280](https://github.com/adafruit/Adafruit_CircuitPython_BMP280)
458+ library (install on the Pico Pi with `circup adadfruit_bmp280`).
459+
460+ In the example I connected the sensor as follows:
461+
462+ | GY-BME/PM280 | Pico Pi Signal | Pin |
463+ |--------------|----------------|-----|
464+ | VCC | 3V3(OUT) | 36 |
465+ | GND | GND | 23 |
466+ | SCL | GP17/I2C0SCL | 22 |
467+ | SDA | GP16/I2C0SDA | 21 |
468+
469+ Running an I²C bus scan in the CircuitPython REPL reveals that the device is
470+ has address 0x76 (118):
471+
472+ ```
473+ >>> import busio
474+ >>> import board
475+ >>> i2c = busio.I2C(board.GP1, board.GP0)
476+ >>> i2c.try_lock()
477+ True
478+ >>> i2c.scan()
479+ [ 118]
480+ ```
481+
482+ This is important, since the Adafruit library defaults to 119. Reading values
483+ from the sensor is straight forward:
484+
485+
486+ ```python
487+ import busio
488+ import board
489+ import adafruit_bmp280
490+
491+ i2c = busio.I2C(board.GP17, board.GP16)
492+ sensor = adafruit_bmp280.Adafruit_BMP280_I2C(i2c, 118)
493+
494+ print(sensor.temperature)
495+ print(sensor.pressure)
496+ ```
497+
498+ The first sensor I tried was broken. It was correctly detected during the bus
499+ scan, but delivered wrong measurements all the time. Luckily I had some more
500+ at hand to test wether it was a software or a hardware problem.
501+
432502## Misc
433503
434504### WS2812 protection circuit
0 commit comments