When writing applications in Node, you often need to write or read contents of a file. Node.js provides a
fs library dedicated for this purpose. But how do we deal with filesystem when testing our code?
I’m going to present two approaches to this problem – by mocking individual filesystem methods and by using virtual file in-memory file system. I’m also going to explain why the latter is much better choice than the former.
The simplest solution is to directly mock individual methods of
fs module. …
When you are making a LED project, you often need to control it using PWM. For RGB projects you need at least 3 PWM channels. If you wanted to control 10 individual RGBs, you need 30 PWM channels, unless you use external driver IC or digital LEDs like WS2812.
Most AVR microcontrollers don’t have that many hardware PWM channels. You can do software PWM emulation, but it costs precious CPU time (unless it has nothing other to do), so we’d like to stay with hardware solutions.
Microcontrollers from XMEGA family are called “Atmega on steroids”, because they are like normal…
Raspberry Pi 4B has one well known issue — it doesn’t power up when plugged using some USB-C cables. It may work with old USB-C to USB 2.0 cable, but, for instance, with original MacBook charger it doesn’t. In general, it won’t work with electrically marked (e-marked) cables, but works well with ‘dumb’ cables.
This issue has recently been fixed in revision 1.2 of Raspberry board, however you can still come across older hardware versions. To check your board revision, see this page.
I got used to use Expo. It has many useful, ready to use libraries and an awesome Client app. Recently I’ve been working on React Native app, which used Firebase Cloud Firestore as main database.
Update 06/2021: Expo made a huge progress since I wrote this article. I’m writing an updated blog post about Expo and Firebase integration. Stay tuned.
Update 12/2020: Some parts of this article may be outdated, however the main idea of using both native and web Firebase SDK is still worth considering — Expo team has released “EAS Build” which let users build their Bare workflow…
Enthusiast of electronics and all kinds of software development — from web apps to embedded systems.