1

Тема: M202MD10D

#include <SoftwareSerial.h>
SoftwareSerial serial(3, 2);//RX,TX

void setup() {
  serial.begin(9600);
  VFD_reset();
  VFD_brig(1);// 0-5
}

void loop() { 
  VFD_cursor(0,0);
  VFD_print_str("RCL-RADIO.RU");
  VFD_cursor(1,0);
  VFD_print_num(1234567890);
  VFD_cursor(1,12);
  VFD_print_float(1.2569,3);
  VFD_cursor(0,15);
  VFD_character(0x15, 0b011000100, 0b00111001, 0b11110111, 0b00001001, 0b00000000);// addr = 0x15-0x1E
  delay(200);
}

void VFD_reset(){serial.write(0x1F);}
void VFD_clear(){serial.write(0x0D);}
void VFD_cursor(byte st, byte sim){serial.write(0x10);serial.write(st*20+sim);}
void VFD_print_str(char*data){serial.print(data);}
void VFD_print_num(long data){serial.print(data);}
void VFD_print_float(float data, byte z){serial.print(data,z);}
void VFD_brig(byte br){
 serial.write(0x04);
 switch(br){
  case 0: serial.write(byte(0x00));
  case 1: serial.write(0x20);
  case 2: serial.write(0x40);
  case 3: serial.write(0x60);
  case 4: serial.write(0x80);
  case 5: serial.write(0xFF);
  }
}

void VFD_character(byte addr, byte m1,byte m2, byte m3, byte m4, byte m5){
  serial.write(0x03);
  serial.write(addr);// 0X15-0X1E
  serial.write(byte(m1));
  serial.write(byte(m2));
  serial.write(byte(m3));
  serial.write(byte(m4));
  serial.write(byte(m5));
  serial.write(addr);
  }