Skip to content

Instantly share code, notes, and snippets.

View carlosdelfino's full-sized avatar
💭
Estudando Salesforce e seu ecosistema

Carlos Delfino carlosdelfino

💭
Estudando Salesforce e seu ecosistema
View GitHub Profile
@carlosdelfino
carlosdelfino / ESCRITA DO GPS.CPP
Created August 14, 2012 21:09
Leitura do GPS, atualmente uso GPS_PRIORIZE = 1
inline boolean newNMEAreceived() {
return !resetingGPS && gps.newNMEAreceived();
}
void lerGPS(){
if (!serialOff()) {
#if GPS_PRIORIZE > 2
for (uint8_t i = 6; nmea_rb.ahead && nmea_rb.head != nmea_rb.tail && i > 0; --i) {
// if the head isn't ahead of the tail, we don't have any characters
@carlosdelfino
carlosdelfino / Cadeira_Inteligente.cpp
Last active June 3, 2020 17:11
Código para controle e segurança de uma Cadeira de Rodas Inteligente.
/*
Cadeira Inteligente
Código para controle de Cadeira de Rodas.
O Código lê o nível de sinal nas portas analógicas A0 e A1,
A0 indica se deve ir para frente ou para traz.
A1 indica se deve dar mais potência para Direita ou para Esquerda
Foram criadas algumas constantes, para facilitar o ajuste de valores para calibração do código.

Licence (MIT Licence)

Copyright (c) 2011 Simon Walker

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

/*****************
By Param Aggarwal
www.feemo.in
AccPOV
Uses an accelerometer to sense when it is being waved in the air.
Uses Arduino Decimilia and Accelerometer and a custom made shield for the Arduino.
*******************/
// Display goes on PORTD
@carlosdelfino
carlosdelfino / botao_muda_for
Created March 6, 2014 22:19
Alterna For, conforme botão prescionado.
onst int buttonPin1 = 2;
const int buttonPin2 = 3;
int valor=0;
void setup() {
pinMode(buttonPin1, INPUT);
pinMode(buttonPin2, INPUT);
Serial.begin(9600);
@carlosdelfino
carlosdelfino / enviando_sms.ino
Last active August 29, 2015 14:02 — forked from anonymous/gist:6c1c43beca7ae04cad74
um exemplo de código para envio de SMS, o codigo pode ser melhorado e optimizado em muitos pontos.
#include <SoftwareSerial.h>
SoftwareSerial mySerial(2, 3); //RX, TX
//Ligando o Shield GSM SIM900.
int powerkey = 5;
int statuspin = 6;
int pinState = 0;
@carlosdelfino
carlosdelfino / nana_arduino.ino
Last active December 18, 2017 17:07
Exemplo de código que coloca o Arduino para Dormir.
#include <avr/interrupt.h>
#include <avr/sleep.h>
byte mode; // SLEEP_MODE_IDLE, SLEEP_MODE_PWR_DOWN, SLEEP_MODE_PWR_SAVE, SLEEP_MODE_ADC, SLEEP_MODE_STANDBY, SLEEP_MODE_EXT_STANDBY
void setup(){
// configurações básicas do Arduino
// aqui você pode colocar o codigo que seleciona o Modo
set_sleep_mode(mode); // seleciona como o Arduino irá dormir, isso impacta na forma que o Arduino acorda
@carlosdelfino
carlosdelfino / one_line_lcd_scroll.ino
Last active August 29, 2015 14:04
Scrooll de uma linha em LCD, é preciso alguns ajustes, mas este é o caminho, o primeiro passo.
#include <LiquidCrystal.h>
#define DELAY_STR (500)
#define DELAY_BLOCK (300)
#define DELAY_CHAR (20)
#define DELAY_RESTART (500)
LiquidCrystal lcd1(7, 6, 12, 11, 10, 9);
// 0 1 2 3
// 012345678901234567890123456789012345
@carlosdelfino
carlosdelfino / RTgoertzelFilter.c
Created July 31, 2014 03:52
analisando o uso do Algoritimo Goertzel, as anotações aqui presentes são para uso no artigo referente ao uso do Algortimo com Arduino. todos foram obtidos no link: http://netwerkt.wordpress.com/2011/08/25/goertzel-filter/
double RTgoertzelFilter(int sample, double freq) {
static double s_prev = 0.0;
static double s_prev2 = 0.0;
static double totalpower = 0.0;
static int N = 0;
double coeff,normalizedfreq,power,s;
normalizedfreq = freq / SAMPLEFREQUENCY;
coeff = 2*cos(2*M_PI*normalizedfreq);
s = sample + coeff * s_prev - s_prev2;
s_prev2 = s_prev;
@carlosdelfino
carlosdelfino / InternalTemp.c
Last active August 29, 2015 14:05
Um monitor de temperatura triplo baseado em NTC, LM35 e o termômetro interno do Arduino.
double readInternalTemp() {
ADMUX = _BV(REFS1) | _BV(REFS0) | _BV(MUX3);
delay(2);
double result;
byte mean = 0;
for(;mean < MEAN_TEMP_INTERNAL; mean++){
ADCSRA |= _BV(ADSC);
while (bit_is_set(ADCSRA, ADSC));
result += ((ADCH << 8) | ADCL);