Thứ Ba, 18 tháng 12, 2018

Rf receiver gerber





// receiver.pde

#include <VirtualWire.h>
int count;
const int ledPin10 = 0;
const int ledPin11 = 1; 
const int ledPin0 = 2;
const int ledPin1 = 3;
const int ledPin2 = 4;
const int ledPin3 = 5;
const int ledPin4 = 6;
const int ledPin5 = 7;
const int ledPin6 = 8;
const int ledPin7 = 9;
const int ledPin8 = 10;
const int ledPin9 = 11;

void setup()
{
   // Serial.begin(9600);// Debugging only
   //  Serial.println("setup"); //Prints "Setup" to the serial monitor
     pinMode(ledPin0, OUTPUT);
     pinMode(ledPin1, OUTPUT);
     pinMode(ledPin2, OUTPUT);
     pinMode(ledPin3, OUTPUT);
     pinMode(ledPin4, OUTPUT);
     pinMode(ledPin5, OUTPUT);
     pinMode(ledPin6, OUTPUT);
     pinMode(ledPin7, OUTPUT);
     pinMode(ledPin8, OUTPUT);
     pinMode(ledPin9, OUTPUT);
     
     pinMode(ledPin10, OUTPUT);
     pinMode(ledPin11, OUTPUT);
     digitalWrite(ledPin8,LOW); 
  

    vw_set_rx_pin(13);       //Sets pin D12 as the RX Pin
    //vw_set_ptt_inverted(true); // Required for DR3100
    vw_setup(4000);     // Bits per sec
    vw_rx_start();       // Start the receiver PLL running
    
}

void loop()
{
    uint8_t buf[VW_MAX_MESSAGE_LEN];
    uint8_t buflen = VW_MAX_MESSAGE_LEN;
    if (vw_get_message(buf, &buflen)) // Non-blocking
    {
int i;
          // Flash a light to show received good message
// Message with a good checksum received, dump it.
//Serial.print("Got: ");
for (i = 0; i < buflen; i++)
{
            char c = (buf[i]);
            Serial.print(c);
    Serial.print(" ");
  if (buf[i] =='0')
 {
    digitalWrite(ledPin0,HIGH);  
 }
  if (buf[i] =='1')
 {
    digitalWrite(ledPin0,LOW);  
 }


   if (buf[i] =='2')
 {
    digitalWrite(ledPin1,HIGH);  
 }
  if (buf[i] =='3')
 {
    digitalWrite(ledPin1,LOW);  
 }


    if (buf[i] =='4')
 {
    digitalWrite(ledPin2,HIGH);  
 }
  if (buf[i] =='5')
 {
    digitalWrite(ledPin2,LOW);  
 }


    if (buf[i] =='6')
 {
    digitalWrite(ledPin3,HIGH);  
 }
  if (buf[i] =='7')
 {
    digitalWrite(ledPin3,LOW);  
 }


     if (buf[i] =='8')
 {
    digitalWrite(ledPin4,HIGH);  
 }
  if (buf[i] =='9')
 {
    digitalWrite(ledPin4,LOW);  
 }


     if (buf[i] =='a')
 {
    digitalWrite(ledPin5,HIGH);  
 }
  if (buf[i] =='b')
 {
    digitalWrite(ledPin5,LOW);  
 }

      if (buf[i] =='c')
 {
    digitalWrite(ledPin6,HIGH);  
 }
  if (buf[i] =='d')
 {
    digitalWrite(ledPin6,LOW);  
 }

       if (buf[i] =='e')
 {
    digitalWrite(ledPin7,HIGH);  
 }
  if (buf[i] =='f')
 {
    digitalWrite(ledPin7,LOW);  
 }

        if (buf[i] =='g')
 {
    digitalWrite(ledPin8,HIGH);  
 }
  if (buf[i] =='h')
 {
    digitalWrite(ledPin8,LOW);  
 }

         if (buf[i] =='i')
 {
    digitalWrite(ledPin9,HIGH);  
 }
  if (buf[i] =='j')
 {
    digitalWrite(ledPin9,LOW);  
 }




          if (buf[i] =='k')
 {
    digitalWrite(ledPin10,HIGH);  
 }
  if (buf[i] =='l')
  
 {
    digitalWrite(ledPin10,LOW);  
    
    
 }
          if (buf[i] =='m')
 {
    digitalWrite(ledPin11,HIGH);  
 }
  if (buf[i] =='n')
 {
    digitalWrite(ledPin11,LOW);  
 }
       // count++;
       //Serial.print(count);
//Serial.println("");

} }}    

Không có nhận xét nào:

Đăng nhận xét

Bài đăng mới nhất

ALEPH-M CLASS A ANFİ DEVRESİ N KANAL MOSFET

Aleph-M çıkış gücü yaplaşık olarak 35w Class A sınıfı anfi için oldukca iyi bir değer çıkış modfetleri n kanal 2 adet irfp240 kullanılmış be...

Bài đăng phổ biến