
Security News
vlt Launches "reproduce": A New Tool Challenging the Limits of Package Provenance
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
The ioemu-project provides an emulator for input/output operations with simple electronic components like LEDs and push buttons.
Use pip for a simple installation. For an update use install --upgrade
.
python3 -m pip install ioemu
python -m pip install ioemu
First start the emulator by entering ioemu
on the commandline. A Gui will show up.
It contains a slider for analog values between 0 and 99, threee LEDs and two push buttons from left to right.
If the emulator is running, you can interact with it from any python program running on the same machine. First import the class Emulator
from the ioemu
package.
from ioemu import Emulator
Now create an instance of the emulator and switch some LEDs on. They can be controlled by setting the leds
attribute.
emu = Emulator()
emu.leds = [True, False, True]
The emulator has two buttons. Their current state (pressed or not pressed) can be read from the attribute buttons
. It's a bool array corresponding to the state of being pressed.
The following program lights up some LEDs depending on the button being pressed.
emu = Emulator()
while True:
if emu.buttons[0]:
emu.leds = [False, True, True]
if emu.buttons[1]:
emu.leds = [True, True, False]
if not (emu.buttons[0] or emu.buttons[1]):
emu.leds = [False, False, False]
Let's look into a program that allows you to control the LEDs with the slider at the left. The current sliders value can be read from the analog_value
attribute of the Emulator. Its value ranges from 0 to 99.
import time
emu = Emulator()
led_on = 0
while True:
if 0 <= emu.analog_value < 25:
emu.leds = [False, False, False]
elif 25 <= emu.analog_value < 50:
emu.leds = [True, False, False]
elif 50 <= emu.analog_value < 75:
emu.leds = [True, True, False]
else:
emu.leds = [True, True, True]
There is a demo program that can be started with python -m ioemu.demo
. It will blink the LEDs and print the current button state as well as the analog value to console.
You can find the source code in demo.py.
If you find any bugs or have a feature request, feel free to file a ticket at the projects bugtracker on github.
FAQs
IO Emulator with LEDs and buttons
We found that ioemu demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
Research
Security News
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.