Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Revision 0:1886145e8e33, committed 2017-09-29
- Comitter:
- tony63
- Date:
- Fri Sep 29 14:37:25 2017 +0000
- Commit message:
- PROGRAMA PARA EMITIR COMANDOS IRDA, CASO DE TV HYUNDAY
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
| mbed.bld | Show annotated file Show diff for this revision Revisions of this file |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Fri Sep 29 14:37:25 2017 +0000
@@ -0,0 +1,194 @@
+/******************** ENLOQUECEDOR DE CONTROL REMOTO TV SMART HYUNDAI*************************************************
+//este programa interfiere de forma loca la operacion de un televisor
+//emite codigos de tv con el fin de fastidiar al televidente
+/*la emision es aleatoria para
+ 1 mute
+ 2 on/off
+ 3 vol+
+ 4 vol-
+ 5 canal +
+ 6 canal -
+*/
+#include "mbed.h"
+DigitalOut ledA (LED1);
+DigitalOut ledR (LED2);
+DigitalOut ledV (LED3);
+
+DigitalOut led(PTE31);//al transistor del led infrarrojo pin
+int i,j;
+int t;
+//*********************TIEMPO PARA TELEVISOR HYUNDAI START TV****************************************
+int cabeceraL=9000;
+int cabeceraH=4555;
+int Tdescanso=500;
+int Tlow=630;
+int Thigh=1750;
+int duracion; //duracion de un pulso bajo
+int numb = 33;
+void mute();
+void vol_up();
+void vol_dwn();
+void ch_up();
+void ch_dwn();
+void pwr();
+void repeat();
+int sendcode(int numb, int *code, int cabeceraL, int cabeceraH, int Tdescanso, int Tlow, int Thigh);
+int code[65];
+int dato[65];
+int descanso(int duracion);
+const unsigned muteHY[] = {581,556,555,582,554,556,581,556,1693,1692,1692,1693,1691,1692,
+ 555,1692,1694,554,1692,554,1692,554,556,581,554,1692,555,1693,554,1692,1692,1692};
+const unsigned pwrHY[]={575,548,548,575,549,549,575,548,1686,1686,1686,1687,1685,1687,549,1686,
+ 1686,1686,576,548,549,576,549,549,576,549,1687,1687,1686,1686,1687,1686};
+const unsigned vol_upHY[]={556,582,557,557,581,555,556,583,1693,1692,1694,1693,1694,1694,556,
+ 1693,556,1695,1695,583,1695,583,557,557,1694,558,583,1695,585,1695,1696,1696};
+const unsigned vol_dwnHY[]={563,564,590,563,562,588,563,563,1700,1700,1699,1700,1700,1699,589,
+ 1700,588,1700,587,1699,1699,562,588,562,1699,561,1699,561,561,1699,1699,1699};
+const unsigned ch_upHY[]={581,580,1694,581,580,580,581,580,1695,1696,605,1694,1695,1695,1695,1694,580,
+ 580,579,580,580,579,579,581,1695,1695,1695,1696,1696,1696,1695,1697,};
+const unsigned ch_dwnHY[]={608,607,1700,607,608,608,608,584,1699,1700,608,1699,1698,1698,1699,1699,1699,
+ 607,583,606,583,607,584,583,608,1699,1700,1700,1699,1699,1698,1699};
+
+int main() {
+ ledA=1;
+ ledR=1;
+ ledV=1;
+ ledA=0;
+ //for(i=0;i<numb;i++){
+ // code[i]=muteHY[i];
+ // }
+
+ while(1){
+
+ mute();
+ wait(2);
+ mute();
+ wait(2);
+ vol_up();
+ wait(1);
+ vol_dwn();
+ wait(1);
+ ch_up();
+ wait(1);
+ ch_dwn();
+ wait(1);
+ pwr();
+ wait(5);
+ pwr();
+ wait(3);
+ //sendcode(numb,code,cabeceraL, cabeceraH, Tdescanso, Tlow, Thigh);
+ //wait(5);
+ }
+}
+//la funcion descanso hace una modulacon, osea un pulso bajo por el tiempo indicado en duracion
+int descanso(int duracion){
+ Timer t;
+ t.reset();
+ t.start();
+ while(1)
+ {
+ led=1;
+ wait_us(8);
+ led=0;
+ led=0;
+ wait_us(9);
+ if(t.read_us() > duracion) return 0;
+
+ }
+ }
+
+int sendcode(int numb, int *code, int cabeceraL, int cabeceraH, int Tdescanso, int Tlow, int Thigh)
+{
+ led=0;
+ wait_ms(100);
+ descanso(cabeceraL);
+ wait_us(cabeceraH);
+
+ for(i=0;i<numb;i++){
+ if (code[i]>1000){
+ descanso(Tdescanso);
+ wait_us(Thigh);
+ }
+ if (code[i]<1000){
+ descanso(Tdescanso);
+ wait_us(Tlow);
+ }
+ }
+ descanso(Tdescanso);
+ return 0;
+}
+//*************************rutinas estrategicas de accionar controles*********************
+void vol_up(){
+for(i=0;i<numb;i++){
+ code[i]=vol_upHY[i];
+ }
+sendcode(numb,code,cabeceraL, cabeceraH, Tdescanso, Tlow, Thigh);
+repeat();
+for(i=0;i<15;i++){
+ for(j=0;j<2;j++){
+ wait_ms(56);
+ repeat();
+ }
+ }
+}
+//**********************************
+void vol_dwn(){
+for(i=0;i<numb;i++){
+ code[i]=vol_dwnHY[i];
+ }
+sendcode(numb,code,cabeceraL, cabeceraH, Tdescanso, Tlow, Thigh);
+repeat();
+for(i=0;i<15;i++){
+ for(j=0;j<2;j++){
+ wait_ms(56);
+ repeat();
+ }
+ }
+}
+//*****************************************************
+void ch_up(){
+for(i=0;i<numb;i++){
+ code[i]=ch_upHY[i];
+ }
+ for(i=0;i<30;i++){
+ sendcode(numb,code,cabeceraL, cabeceraH, Tdescanso, Tlow, Thigh);
+ wait(3);
+
+ }
+
+}
+//*********************************************************
+void ch_dwn(){
+for(i=0;i<numb;i++){
+ code[i]=ch_dwnHY[i];
+ }
+for(i=0;i<30;i++){
+sendcode(numb,code,cabeceraL, cabeceraH, Tdescanso, Tlow, Thigh);
+ wait(3);
+
+ }
+ }
+//******************************************************
+void mute(){
+ for(i=0;i<numb;i++){
+ code[i]=muteHY[i];
+ }
+sendcode(numb,code,cabeceraL, cabeceraH, Tdescanso, Tlow, Thigh);
+ wait(2);
+}
+//**********************************************************
+void pwr(){
+ for(i=0;i<numb;i++){
+ code[i]=pwrHY[i];
+ }
+sendcode(numb,code,cabeceraL, cabeceraH, Tdescanso, Tlow, Thigh);
+}
+//****************************
+
+void repeat(){
+ wait_ms(42);
+ descanso(8800);
+ wait_us(2240);
+ descanso(560);
+ }
+//************************************************
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Fri Sep 29 14:37:25 2017 +0000 @@ -0,0 +1,1 @@ +https://mbed.org/users/mbed_official/code/mbed/builds/093f2bd7b9eb \ No newline at end of file