Skip to content

Commit

Permalink
V0.1.1 (#2)
Browse files Browse the repository at this point in the history
* add gitignore

* change pin names

* gitignore add .vscode

* adding server to echo system

* modifying 14 code

* ota feature

* add schematics to extra

* ota implementation and stop motor func

* stop motor func

* examples 14-updated

* motor action corrections

* example-14 websocket and dependencies

* library.properties and ci update

* aaded io3 and io4

* example:ultrasonic and some cleanup

* example:line follower and some cleanup

* web_page string to be passesd by referance

* added support fro display

* decouple two motors

* ex 11 and 14

* html of buildybee 13 and 14

* 13_main code

* working rgb control

* cosmetics changes and library property updates

* update beebot url

* update version to v0.1.1
  • Loading branch information
say-paul authored Apr 14, 2024
1 parent 8b27afd commit 8294747
Show file tree
Hide file tree
Showing 28 changed files with 568 additions and 1,215 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/arduino-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: arduino/arduino-lint-action@v1
- uses: arduino/arduino-lint-action@v1
with:
library-manager: update
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
src/.*
.vscode/**
Original file line number Diff line number Diff line change
@@ -1,23 +1,29 @@
#include "blite.h"
#include <blite.h>

//connect the ultrasonic sensor(HS-SR04) with 4 pin sensor

//define sound velocity in cm/uS
#define SOUND_VELOCITY 0.034
#define CM_TO_INCH 0.393701

Blite myBot;
int trigPin = myBot.getIO("io3");
int echoPin = myBot.getIO("io4");

long duration;
float distanceCm;
float distanceInch;

#define echoPin D1
#define trigPin D2

void setup() {
myBot.setup();
myBot.smartConnectWiFi();
Serial.begin(115200); // Starts the serial communication
pinMode(trigPin, OUTPUT); // Sets the trigPin as an Output
pinMode(echoPin, INPUT); // Sets the echoPin as an Input
}

void loop() {
myBot.otaLoop();
// Clears the trigPin
digitalWrite(trigPin, LOW);
delayMicroseconds(2);
Expand Down
178 changes: 0 additions & 178 deletions examples/01_wifi_controlled_bot/01_wifi_controlled_bot.ino

This file was deleted.

18 changes: 0 additions & 18 deletions examples/02_auto_obstruction_detection/readme.md

This file was deleted.

44 changes: 44 additions & 0 deletions examples/02_single_ir_line_follower/02_single_ir_line_follower.ino
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
//Connect a IR sensor or TCTR5000 module to IO1 and place the car on a black track with white background ground.
//press the tactile button to start the line follower mode and press gain to stop line following mode.

#include <blite.h>
Blite myBot;
int ir = myBot.getIO("io1");
bool lineFollowerMode = false;
int cs;

void setup()
{
// Debug console
Serial.begin(115200);
myBot.setup();
myBot.reversePolarityM12();
myBot.smartConnectWiFi();

}

void loop()
{
myBot.otaLoop();

if(myBot.buttonPressed()) {
lineFollowerMode = !lineFollowerMode;
}
if (lineFollowerMode){
cs=digitalRead(ir);

if(cs==HIGH)
{
myBot.moveForward();
}
else if(cs==LOW)
{
myBot.turnRight();
}
if (myBot.buttonPressed()){
lineFollowerMode = false;
myBot.stopMotor();
}
}

}
22 changes: 0 additions & 22 deletions examples/03_thermistor/03_thermistor.ino

This file was deleted.

70 changes: 70 additions & 0 deletions examples/04_IoT_neo_pixel/04_IoT_neo_pixel.ino
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
#include <blite.h>
#include "lighting.h"
#include <WebSocketsServer.h>

//install "Adafruit Neopixel" from arduino library manager
#include <Adafruit_NeoPixel.h>

//number of rgb leds present in the device
#define NUM_LEDS 16

Blite myBot;
Adafruit_NeoPixel strip = Adafruit_NeoPixel(NUM_LEDS, myBot.getIO("io1"), NEO_RGB + NEO_KHZ800);
WebSocketsServer webSocket = WebSocketsServer(81);

void setup(){
myBot.setup();
myBot.reversePolarityM12();
Serial.begin(115200);
delay(1000);
if (myBot.buttonPressed()){
myBot.APServer();
} else {
myBot.smartConnectWiFi();
}
webSocket.begin();
webSocket.onEvent(webSocketEvent);
strip.setBrightness(150);
strip.begin();
}
void loop(){
String html = HTML_LIGHT;
myBot.smartRenderServer(html);
webSocket.loop();
}

void webSocketEvent(uint8_t num, WStype_t type, uint8_t* payload, size_t length) {
String command = String((char*)payload);
Serial.print("command: ");
Serial.println(command);
// setting the color to the strip
setNeoColor(command);
}

void setNeoColor(String value){
Serial.print("Setting Neopixel...");
// converting Hex to Int
int number = (int) strtol( &value[1], NULL, 16);
// splitting into three parts
int r = number >> 16;
int g = number >> 8 & 0xFF;
int b = number & 0xFF;

// DEBUG
Serial.print("RGB: ");
Serial.print(r, DEC);
Serial.print(" ");
Serial.print(g, DEC);
Serial.print(" ");
Serial.print(b, DEC);
Serial.println(" ");

// setting whole strip to the given color
for(int i=0; i < NUM_LEDS; i++) {
strip.setPixelColor(i, strip.Color( g, r, b ) );
}
// init
strip.show();

Serial.println("on.");
}
Loading

0 comments on commit 8294747

Please sign in to comment.