Skip to content

Instantly share code, notes, and snippets.

View alvesoaj's full-sized avatar

AJ Alves alvesoaj

View GitHub Profile
@alvesoaj
alvesoaj / raspberry-pi-armv6-d-link-adapter.sh
Last active December 10, 2023 10:30
Script to install DWA-171 D-Link adapter drivers in a Raspberry Pi Armv6
/*
* 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() {
@alvesoaj
alvesoaj / font-awesome-overwrite.scss
Last active December 31, 2021 08:47
Font Awesome overwrite to set the correct font path in Ruby On Rails and work in Production
/*!
* Font Awesome 4.7.0 by @davegandy - http://fontawesome.io - @fontawesome
* License - http://fontawesome.io/license (Font: SIL OFL 1.1, CSS: MIT License)
*/
@import "font-awesome/scss/variables";
/* FONT PATH VARIABLE
* -------------------------- */
$fa-font-path: "font-awesome/fonts/";
/* -------------------------- */
@alvesoaj
alvesoaj / nrf24l01-receiver-test.ino
Last active October 6, 2021 04:59
Code to test nRF24L01 with Arduino (Receiver)
/*
* AJ Alves (aj.alves@zerokol.com)
*/
#include <SPI.h>
#include "nRF24L01.h"
#include "RF24.h"
// Instantiate RF24 class with CE and CSN values
RF24 radio(9, 10);
@alvesoaj
alvesoaj / nrf24l01-transmissor-test.ino
Created August 9, 2018 01:34
Code to test nRF24L01 with Arduino (Transmisso)
/*
* AJ Alves (aj.alves@zerokol.com)
*/
#include <SPI.h>
#include "nRF24L01.h"
#include "RF24.h"
// Instantiate RF24 class with CE and CSN values
RF24 radio(9, 10);
@alvesoaj
alvesoaj / arduino_simple_sample.ino
Last active June 23, 2021 13:35
Simple Sample of eFLL with Arduino
#include <Fuzzy.h>
// Instantiating a Fuzzy object
Fuzzy *fuzzy = new Fuzzy();
void setup()
{
// Set the Serial output
Serial.begin(9600);
// Set a random seed
@alvesoaj
alvesoaj / semantic-commit-messages.md
Last active June 18, 2021 12:30 — forked from joshbuchea/semantic-commit-messages.md
Semantic Commit Messages

Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: <type>(<scope>): <subject>

<scope> is optional

Example

/*
* 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
/*
* 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
}
/*
* 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
}