This application simulates a physical device to sort M&Ms by their color. It receives input through the GPIO pins to control a browser-based physics simulation of the device. It was utilized during the development of a project within a low-level programming lecture.
update & upgrade:
sudo apt-get update
sudo apt-get dist-upgrade
install node:
curl -sL https://deb.nodesource.com/setup_14.x | sudo -E bash -
sudo apt-get install -y nodejs
check if node is installed:
node -v
clone the github repo:
git clone [email protected]:finnweiler/mm-sorting-machine-simulation.git
install npm dependencies:
npm install
To run the simulation:
sudo node index.js
You can now open your browser and enter your Raspberry Pi's hostname (for example: http://raspberry-pi-zero/)
If your are running the simulation of the sorting machine and your code to control it on the same pi, you need to configure the inputs to be outputs within your code. Otherwise the simulation will not be able to set the GPIO pins. Remember to change this back when you connect a physical machine.
@ REVERSED INPUTS
@Pins 9 8 7 6 5 4 3 2 1 0
ldr r0, =#0b001001001001001001001001000000
str r0, [GPIOREG] @Function Select Register 0 (Pin 0 - 9)
@ 19 18 17 16 15 14 13 12 11 10
ldr r0, =#0b001000001001000000001001001001
str r0, [GPIOREG, #4] @Function Select Register 1 (Pin 10 - 19)
@ 27 26 25 24 23 22 21 20
ldr r0, =#0b000000001001000001001001001001
str r0, [GPIOREG, #8] @Function Select Register 1 (Pin 20 - 29)