function get_freq(div){
return div*50-38900;
}
function get_band(fr){
var bb;
if (fr<110000)//fvhf
bb=0x01;
else if (fr<407000)
bb=0x02;//VHF_H
else
bb=0x04;//UHF
return bb;
}
function get_low(fr){
var lo;
var div;
lo=fr+38900; // add FI
div=lo/50;
return (div & 0x00ff);
}
function get_high(fr){
var lo;
var div;
lo=fr+38900; // add FI
div=lo/50;
return (div & 0xff00)>>8;
}
function mostrar(pos){
var fr;
var i;
fr=get_freq(pos)*1000;
i=fr/1000000;
fr=fr%1000000;
if (i<100)
print(" ");
print(i);
print(".");
i=fr/1000;
fr=fr%1000;
if(i==0)
print("000");
else if (i<10){
print("00");
}else if (i<100)
print("0");
if (i)
print(i);
print(".000 Hz");
}
function tuner(fr)
{
I2C1.writeTo(0xC2,[get_high(fr),get_low(fr),0xCC,get_band(fr)]);
}
I2C1.setup({scl:B6, sda:B7}); // Setup I2C
I2C1.writeTo(0xC2,[0xFF]);
The function "tuner" does the major work but it does not seem to work since the tuner does not alter his tencion.
This one is a project that I would like to complete. If someone can check my code he would be grateful for it very much
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
I'm trying to do this
http://qlfecv.wordpress.com/2012/11/14/receptor-45-850-mhz-con-sintonizador-tv-analogica-y-arduino/
is arduino code
I have as follows
The function "tuner" does the major work but it does not seem to work since the tuner does not alter his tencion.
This one is a project that I would like to complete. If someone can check my code he would be grateful for it very much