Sylvain Demortier
Published © GPL3+

Sigfox-Connected Basketball Hoop

Challenge your friends with a connected hoop! This project counts your score using Arduino, Sigfox, and the IoT platform Losant.

BeginnerFull instructions provided3 hours6,762
Sigfox-Connected Basketball Hoop

Things used in this project

Hardware components

Arduino UNO
Arduino UNO
×1
Adafruit IR Break Beam Sensor - 3mm LEDs
×1
9V Battery Clip
9V Battery Clip
×1
9V battery (generic)
9V battery (generic)
×1
Sigfox Radio Shield for Arduino – US
×1

Software apps and online services

Sigfox
Sigfox
Losant Platform
Losant Platform

Story

Read more

Schematics

20170821_184328_3T6HQHAiLi.jpg

Code

sketch_basket_project.ino

Arduino
/* 
 Basketball Goal Sensor
 Author: Sylvain D
 
*/
#include <Wire.h>

// Cooking API libraries
#include <arduinoUART.h>
#include <arduinoUtils.h>

// Sigfox library
#include <arduinoSigfox.h>


//////////////////////////////////////////////
uint8_t socket = SOCKET0;     //Asign to UART0
//////////////////////////////////////////////

uint8_t error;


#define LEDPIN 13
  // Pin 13: Arduino has an LED connected on pin 13
  
#define SENSORPIN 8

// variables will change:
int sensorState = 0, lastState=0;         // variable for reading the pushbutton status

void setup() {
  // initialize the LED pin as an output:
  pinMode(LEDPIN, OUTPUT);      
  // initialize the sensor pin as an input:
  pinMode(SENSORPIN, INPUT);     
  digitalWrite(SENSORPIN, HIGH); // turn on the pullup
  
  Serial.begin(9600);
}

void loop(){
  // read the state of the sensor beam value:
  sensorState = digitalRead(SENSORPIN);

  // check if the sensor beam is broken
  // if it is, the sensorState is LOW:
  if (sensorState == LOW) {     
    // turn LED on:
    digitalWrite(LEDPIN, HIGH);  
  } 
  else {
    // turn LED off:
    digitalWrite(LEDPIN, LOW); 
  }

  // Check if the sensor beam is broken
  //If it is, the sensorState is LOW:
    if (sensorState == LOW) {     
    // Send message "123456" via Sigfox:
    Sigfox.send ((char *) "123456");  
  } 
  else {
    // turn LED off:
    digitalWrite(LEDPIN, LOW); 
  }
  lastState = sensorState;
}

Credits

Sylvain Demortier

Sylvain Demortier

0 projects • 2 followers

Comments