Skip to content

Instantly share code, notes, and snippets.

@samirfor
Created April 9, 2015 23:53
Show Gist options
  • Save samirfor/1236fe2ff6dd5290fd8a to your computer and use it in GitHub Desktop.
Save samirfor/1236fe2ff6dd5290fd8a to your computer and use it in GitHub Desktop.
/**
* Ferramenta SanUSB: http://sanusb.site50.net/
* Compilar com MPLABX+C18: https://drive.google.com/open?id=0B5332OAhnMe2N3czQWxVX0JVSkE&authuser=0
* Apk BluRelay para Android: https://github.com/samirfor/BluRelay/blob/master/BluSwitch.apk?raw=true
*
* Este programa recebe comandos do app BluRelay via bluetooth.
*
*/
#include "SanUSB48.h"
#pragma interrupt interrupcao
unsigned char c;
unsigned int valor, n = 0, numquant1 = 0;
void interrupcao() {
if (serial_interrompeu) {
serial_interrompeu = 0;
c = le_serial() + 0x30;
}
}
void main() {
clock_int_48MHz();
habilita_interrupcao(recep_serial);
c = 5 + 0x30; // valor padrão incial
taxa_serial(19200);
while (1) {
if (!entrada_pin_e3) {
Reset(); // botão reset
}
inverte_saida(pin_b7);
valor = (c - 0x30);
tempo_ms(valor * 100);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment