Yvan 🔜(ish) #40c3 on Nostr: FUCKING A! I have a #Rust programme on my #RaspberryPi #PicoW that reads data (an ...
FUCKING A!
I have a #Rust programme on my #RaspberryPi #PicoW that reads data (an u16) from a sensor and you can then get that data from a web request. HUGE ACHIEVEMENT.
It has taken me like… a large chunk of three days… To get to this point from having code that reads the sensor and serves web requests. 😂 I feel like a moron. But hey, I've only been coding Rust for ~5 days. Probably taking the hard path by going straight into embedded with no::std…
It has taken so many attempts to get to grips with scopes, mutables, Rust's bloody intense syntax, etc, etc… but in the end I've worked out a way to pass a u16 to both spawned workers via some sort of a Mutex. I think I might have an extra level of indirection I don't need… but fuck it, I'll take that I can do this at all as a win.
Now I can take it outside (i.e. not USB-tethered) and see what it reads as an outdoor CO2 PPM measurement.
(I could have had this working in C++ in… minutes, but no, I'm a masochist.)
#embedded #embassy
Published at
2025-03-16 22:34:14 UTCEvent JSON
{
"id": "30392545b972c03b1f4a295f1178836bca6a7a5b502a110ab2fa63e8bd9eb918",
"pubkey": "390c934899155ad1361f83c6d1cbb0cfd2a9f1d85b0525fbf359ca9725e397e7",
"created_at": 1742164454,
"kind": 1,
"tags": [
[
"t",
"rust"
],
[
"t",
"raspberrypi"
],
[
"t",
"picow"
],
[
"t",
"embedded"
],
[
"t",
"embassy"
],
[
"proxy",
"https://toot.ale.gd/users/yvan/statuses/114174489701041805",
"activitypub"
]
],
"content": "FUCKING A!\n\nI have a #Rust programme on my #RaspberryPi #PicoW that reads data (an u16) from a sensor and you can then get that data from a web request. HUGE ACHIEVEMENT.\n\nIt has taken me like… a large chunk of three days… To get to this point from having code that reads the sensor and serves web requests. 😂 I feel like a moron. But hey, I've only been coding Rust for ~5 days. Probably taking the hard path by going straight into embedded with no::std…\n\nIt has taken so many attempts to get to grips with scopes, mutables, Rust's bloody intense syntax, etc, etc… but in the end I've worked out a way to pass a u16 to both spawned workers via some sort of a Mutex. I think I might have an extra level of indirection I don't need… but fuck it, I'll take that I can do this at all as a win. \n\nNow I can take it outside (i.e. not USB-tethered) and see what it reads as an outdoor CO2 PPM measurement.\n\n(I could have had this working in C++ in… minutes, but no, I'm a masochist.)\n\n#embedded #embassy",
"sig": "502366a4aa47ea52ca7ff9d0b8bc20ea276574e17597659a6c4a53c0fa7e2a0141cd95909d129cf19dcff8ec8aec1f455c13ffc26cf4d63c974cb26274fa1979"
}