The goal was to use the Ping example as an introduction to mesh programming using the FruityMesh framework. The exercise is to have a module control an RGB LED to reflect its node's proximity to other nodes.
The LED is dimmed when disconnected from other nodes and turns green when its signal strength is high, orange when medium and red when low.
The LED is connected to GPIOs 18, 19 and 20. PingModule was added to the project and modified to support the Timer Tick callback, to check signal strength every second.
Using simple arithmetic, it changes the LED's colours based on the node's signal strength with its neighbours.
Modified Ping Module
The original PingModule was adapted here.
The highlights of the changes are:
- Include NRF GPIO support
- Initialise GPIOs and timer values in
- Implement the
PingModule::TimerEventHandlermethod to send a ping to other nodes in broadcast mode.
- Modified the
PingModule::ConnectionPacketReceivedEventHandlermethod to control the LED's colours based on the absolute value of the sum of the RSSI values for all neighbouring nodes.
Up and running
You are welcome to use my VM setup to quickly bring up a complete NRF51/FruityMesh development up and running to experiment with this exciting platform. If you are on a Mac, and want to develop directly from it, skip the VM building and try my Ansible set up for Mac OS X here.
- Fork it (https://github.com/ihassin/fruity-ping/fork)
- Create your feature branch (git checkout -b my-new-feature)
- Commit your changes (git commit -am 'Add some feature')
- Push to the branch (git push origin my-new-feature)
- Create a new Pull Request
Code of conduct
We adhere to the code of conduct as described here.
This repo adheres to the license as it is stated here.