• Enter email to sit in the first row

Compiling C project for Raspberry Pi and BBMagic FLOOD

To run Linux application that receives messages from BBMagic FLOOD sensor you only need:

  • BBMagic FLOOD module with battery
  • Raspberry Pi zero W or Raspberry Pi 3 (both have Bluetooth Low Energy) with operating system installed

Installing gcc compiler

To install gcc log in to the system and type:sudo apt-get install gcc
gcc Raspberry Pi install

Get example project file

Download example ‘bbmagic_flood_sketch’ from Download page.
…or in text mode: wget http://bbmagic.net/download/src/bbmagic_flood_sketch.tar.gz
bbmagic_flood_sketch download
Unpack project file tar.gz:tar -zxvf bbmagic_flood_sketch.tar.gz and go to the project folder:cd bbmagic_flood_sketch
bbmagic_flood_sketch unpack

Compile the project

To compile type: make
bbmagic_flood_sketch gcc compilation

Run program

Dont forget to power up the BBMagic FLOOD sensor
BBMagic FLOOD battery
Make sure executable file has proper permissions and if not change them:chmod 755 bbmagic_flood_sketch
…and run application:sudo ./bbmagic_flood_sketch
bbmagic_flood_sketch running
After a while put BBMagic FLOOD sensor’s electrodes to the water
BBMagic FLOOD in water
…and watch the screen… you get flood alert 🙂
bbmagic_flood_sketch flood alert
Ctrl+C ends our little program.
Awsome job !! Congratulations !!
If you want LED indicates bluetooth transmission connect it like this (two possibilities)
BBMagic RPI LED connection

Tagged , , , . Bookmark the permalink.

Comments are closed.