Skip to content

Instantly share code, notes, and snippets.

Avatar

AJ Alves zerokol

View GitHub Profile
@zerokol
zerokol / raspberry-pi-armv6-d-link-adapter.sh
Last active Feb 24, 2021
Script to install DWA-171 D-Link adapter drivers in a Raspberry Pi Armv6
View raspberry-pi-armv6-d-link-adapter.sh
View hw-390-arduino.ino
/*
* AJ Alves (aj.alves@zerokol.com)
*/
const int MOISTURE_ANALOGIC_IN = A0; // Arduino's analogic pin
const int BOARD_RESOLUTION = 1024; // The analogic board resolution, for example Arduino Uno is 10 bit (from 0 to 1023)
const float OPERATIONAL_VOLTAGE = 5.0; // The default Arduino voltage
const float MAX_SENSOR_VOLTAGE = 3.0; // The maximum voltage that the sensor can output
const float SENSOR_READ_RATIO = OPERATIONAL_VOLTAGE / MAX_SENSOR_VOLTAGE; // The ratio betwent the two voltages
void setup() {
View baterry-level-reader.ino
/*
* AJ Alves (aj.alves@zerokol.com)
*/
#define BATERRY_LEVEL_IN A0 // Arduino analogic pin
#define ANALOGIC_RESOLUTION 1024 // The analogic board resolution, for example, Arduino Uno is 10 bit (from 0 to 1023)
#define REFERENCE_VOLTAGE 5.0 // The reference voltage, for example, Arduino Uno works in 5 V reference voltage by default
#define R1 3000000.0 // resistance of R1 (3 MR)
#define R2 1000000.0 // resistance of R2 (1 MR)
#define EXPECTED_V_OUT 12 // The intented voltage, 12 V
View p45-liquid-level-arduino.ino
/*
* AJ Alves (aj.alves@zerokol.com)
*/
#define SENSOR_PIN 2 // Arduino pin that will read the sensor state
void setup() {
Serial.begin(9600); // Setup Serial Port
pinMode(SENSOR_PIN, INPUT); // Set pin as INPUT
}
View water-pump-arduino.ino
/*
* AJ Alves (aj.alves@zerokol.com)
*/
#define PUMP_PIN 2 // Water Pump Pin
void setup() {
Serial.begin(9600); // Serial Port setup
pinMode(PUMP_PIN, OUTPUT); // Set pin as OUTPUT
}
View rain-sensor-arduino.ino
/*
* AJ Alves (aj.alves@zerokol.com)
*/
#define RAIN_ANALOGIC_IN A0 // Arduino's analogic pin
#define RAIN_DIGITAL_IN 4 // Arduino's digital pin
#define BOARD_RESOLUTION 1024 // The analogic board resolution, for example Arduino Uno is 10 bit (from 0 to 1023)
void setup() {
Serial.begin(9600); // Serial Port setup
View tcrt5000-arduino.ino
int ledPin = 13; // Arduino' inner led
int sigPin = 4; // For sensor signal
int value = 0; // Holds the returned value
void setup(){
Serial.begin(9600);
pinMode(ledPin, OUTPUT); // Arduino's led as output
pinMode(sigPin, INPUT); // signal pin as input
}
View ldr-nodemcu.ino
/*
* AJ Alves (aj.alves@zerokol.com)
*/
int ANALOG_PIN = A0; // The NodeMCU Analogic Pin
int BOARD_RESOLUTION = 1024 ; // The analogic board resolution, for example NodeMCU ESP8266 is 10 bit (from 0 to 1023)
int val = 0; // A varaible to hold the value
void setup() {
Serial.begin(9600); // Serial Port setup
}
View ldr-arduino.ino
/*
* AJ Alves (aj.alves@zerokol.com)
*/
int ANALOG_PIN = A0; // The Arduino Analogic Pin
int BOARD_RESOLUTION = 1024 ; // The analogic board resolution, for example Arduino Uno is 10 bit (from 0 to 1023)
int val = 0; // A varaible to hold the value
void setup() {
Serial.begin(9600); // Serial Port setup
}
@zerokol
zerokol / arduino_advanced_sample.ino
Created Mar 1, 2019
Advanced Sample of eFFL with Arduino
View arduino_advanced_sample.ino
#include <Fuzzy.h>
// For scope, instantiate all objects you will need to access in loop()
// It may be just one Fuzzy, but for demonstration, this sample will print
// all FuzzySet pertinence
// Fuzzy
Fuzzy *fuzzy = new Fuzzy();
// FuzzyInput