Teenenggr
Published © Apache-2.0

Remote Controlled Cannon using Arduino | Gone Wrong

In this video will see how to make remote controlled cannon using arduino and radio module (NRF24L01).

IntermediateFull instructions provided643
Remote Controlled Cannon using Arduino | Gone Wrong

Things used in this project

Hardware components

Arduino Nano R3
Arduino Nano R3
×1
nRF24 Module (Generic)
×1
Jumper wires (generic)
Jumper wires (generic)
×1
Pushbutton Switch, Push-Pull
Pushbutton Switch, Push-Pull
×1
9V battery (generic)
9V battery (generic)
×2

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Custom parts and enclosures

Tranreceiver

Receiver

Schematics

Schematics

Code

Tranreceiver

Arduino
#include  <SPI.h>
#include "nRF24L01.h"
#include "RF24.h"
int buttonPIN = 3;
int msg[1];
RF24 radio(9,10);
const uint64_t pipe = 0xE8E8F0F0E1LL;
int pVal = 1;

void setup() {
  // put your setup code here, to run once:
pinMode(buttonPIN, INPUT);
Serial.begin(9600);
radio.begin();
 radio.openWritingPipe(pipe);
}

void loop() {
  // put your main code here, to run repeatedly:
int val = digitalRead(buttonPIN);

if (val != pVal) {
 msg[0] = val ? 4 : 5;
 radio.write(msg, 1);
 Serial.println("data sent---");
Serial.println(msg[0]); 
 pVal = val;
 }
}

Receiver

Arduino
#include <SPI.h>
#include "nRF24L01.h"
#include "RF24.h"
int msg[1];
RF24 radio(9,10);
const uint64_t pipe = 0xE8E8F0F0E1LL;
int LED1 = 3;
void setup(void){
 Serial.begin(9600);
 radio.begin();
 radio.openReadingPipe(1,pipe);
 radio.startListening();
 pinMode(LED1, OUTPUT);
 digitalWrite(LED1, HIGH);
}
void loop(void){
 if (radio.available()){
   bool done = false;    
   while (!done){
      radio.read(msg, 1);      
//     Serial.println(msg[0]);
     if (msg[0] == 5){
      delay(10);
      digitalWrite(LED1, HIGH);
      Serial.println(msg[0]);
      }
     else if (msg[0] == 4 ){
      digitalWrite(LED1, LOW);
      Serial.println(msg[0]);
      }
     delay(10);
     }
 }
 else{
  Serial.println("No radio available");
  }
}

Credits

Teenenggr
11 projects • 16 followers
https://teenenggr.com YouTube ▶︎ https://www.youtube.com/c/teenenggr

Comments