S-meter pour radio cb avec un arduino

Поділитися
Вставка
  • Опубліковано 7 вер 2024
  • Fabrication d’un s-meter avec un ecran 1.3po oled et un arduino pour radio cb

КОМЕНТАРІ • 9

  • @profimax_ru
    @profimax_ru 5 місяців тому +1

    Looks very nice

  • @ElectroLIB
    @ElectroLIB 4 місяці тому +1

    Génial l'idée de modifier un vue analogique ! J'adore aussi découvrir d'autres Québécois passionnés par les microcontrôleurs Arduino ! De quel coin du Québec pratiquez-vous votre passion ? 👍

    • @ve2ydq345
      @ve2ydq345  4 місяці тому +1

      Le ville de quebec meme

  • @14KiloWhisky
    @14KiloWhisky 9 місяців тому +1

    C'est stylé ! 😁👍

  • @generalingwer4341
    @generalingwer4341 6 місяців тому

    I love it.❤was just thinking about this recently.i dont really understand these oled boards.i hope to figure this out one day.i dont do well with things that need programming.🙂

  • @laurentconstantin4877
    @laurentconstantin4877 Рік тому +1

    cool tu partage le fichier ?

    • @ve2ydq345
      @ve2ydq345  Рік тому +4

      #include // requried to run I2C SH1106
      #include // requried to run I2C SH1106
      #include // github.com/adafruit/Adafruit-GFX-Library
      //#include
      #include
      #include
      noDelay SM(100);
      #define OLED_RESET 4
      //Adafruit_SSD1306 display(OLED_RESET);
      Adafruit_SH1106 display(OLED_RESET);
      //#if (SSD1306_LCDHEIGHT != 64 )
      //#error("Height incorrect, please fix Adafruit_SSD1306.h!");
      //#endif
      #if (SH1106_LCDHEIGHT != 64)
      #error("Height incorrect, please fix Adafruit_SH1106.h!");
      #endif
      boolean unefois;
      int analogInput = A0; // analog input
      int hMeter = 65; // horizontal center for needle animation
      int vMeter = 85; // vertical center for needle animation (outside of dislay limits)
      int rMeter = 69; // longeur de l'aiguil defaul 80
      unsigned int sample;
      int MeterValue = 0;
      // VU meter background mask image:
      static const unsigned char PROGMEM VUMeter[] = {
      0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
      0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
      0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
      0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0x11, 0x00, 0x01, 0x8E, 0x00, 0x00, 0x00, 0x00, 0x00,
      0x00, 0x00, 0x00, 0x00, 0x00, 0x88, 0x00, 0x11, 0x00, 0x02, 0x51, 0x00, 0x00, 0x00, 0x00, 0x00,
      0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x0F, 0x00, 0x00, 0x51, 0x00, 0x00, 0x00, 0x00, 0x00,
      0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x01, 0x00, 0x20, 0x51, 0x00, 0x00, 0x00, 0x00, 0x00,
      0x00, 0x00, 0x03, 0x80, 0x00, 0xF0, 0x00, 0x01, 0x00, 0x20, 0x51, 0x00, 0x04, 0x70, 0x00, 0x00,
      0x00, 0x00, 0x04, 0x40, 0x00, 0x88, 0x00, 0x11, 0x00, 0xF8, 0x91, 0x00, 0x0C, 0x88, 0x00, 0x00,
      0x00, 0x00, 0x00, 0x40, 0x00, 0x88, 0x00, 0x0E, 0x00, 0x21, 0x11, 0x00, 0x0C, 0x88, 0x00, 0x00,
      0x00, 0x00, 0x00, 0x40, 0x00, 0x88, 0x00, 0x00, 0x00, 0x22, 0x11, 0x02, 0x14, 0x88, 0x00, 0x00,
      0x00, 0x00, 0x01, 0x80, 0x00, 0x70, 0x00, 0x00, 0x00, 0x03, 0xCE, 0x02, 0x14, 0x88, 0x00, 0x00,
      0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0xA4, 0x88, 0x00, 0x00,
      0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x3E, 0x88, 0x00, 0x00,
      0x00, 0x00, 0x04, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x04, 0x88, 0x00, 0x00,
      0x00, 0x00, 0x03, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x70, 0x00, 0x00,
      0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00,
      0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00,
      0x07, 0x00, 0x00, 0x00, 0x00, 0x20, 0x41, 0x04, 0x01, 0x00, 0x40, 0x00, 0x00, 0x00, 0x0C, 0x70,
      0x08, 0x80, 0x00, 0x00, 0x00, 0x10, 0x41, 0x04, 0x01, 0x00, 0x80, 0x00, 0x00, 0x00, 0x12, 0x88,
      0x08, 0x80, 0x00, 0x00, 0x08, 0x11, 0xFF, 0xFC, 0x7F, 0xF0, 0x80, 0x00, 0x00, 0x00, 0x10, 0x88,
      0x08, 0x80, 0x00, 0x80, 0x08, 0x3F, 0xFF, 0xFC, 0x7F, 0xFF, 0xC0, 0x40, 0x10, 0x01, 0x10, 0x88,
      0x08, 0x80, 0x00, 0x42, 0x0F, 0xFF, 0x00, 0x00, 0x00, 0x1F, 0xFE, 0x40, 0x20, 0x01, 0x1C, 0x88,
      0x08, 0x80, 0x00, 0x41, 0xFF, 0xE0, 0x00, 0x00, 0x00, 0x00, 0x7F, 0xE0, 0x20, 0x07, 0xD2, 0x88,
      0x08, 0x80, 0x00, 0x47, 0xF8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0xFC, 0x20, 0x01, 0x12, 0x88,
      0x08, 0x80, 0x00, 0x3F, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1F, 0xC0, 0x01, 0x12, 0x88,
      0x07, 0x00, 0x01, 0xFC, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xF8, 0x00, 0x0C, 0x70,
      0x00, 0x00, 0x1F, 0xE0, 0x00, 0x00, 0x03, 0xFF, 0xFC, 0x00, 0x00, 0x00, 0x7E, 0x10, 0x00, 0x00,
      0x02, 0x00, 0x3F, 0x00, 0x00, 0x03, 0xFC, 0x04, 0x03, 0xFE, 0x00, 0x00, 0x0F, 0xE0, 0x08, 0x00,
      0x01, 0x00, 0xF8, 0x00, 0x00, 0xFC, 0x10, 0x04, 0x00, 0x81, 0xE0, 0x00, 0x03, 0xF0, 0x08, 0x00,
      0x01, 0x07, 0xE0, 0x00, 0x1F, 0x40, 0x10, 0x04, 0x00, 0x80, 0x3F, 0x80, 0x00, 0x78, 0x10, 0x00,
      0x00, 0x9F, 0x80, 0x00, 0xE0, 0x40, 0x10, 0x00, 0x00, 0x80, 0x20, 0x70, 0x00, 0x1F, 0x10, 0x00,
      0x00, 0xBC, 0x00, 0x07, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x20, 0x1C, 0x00, 0x07, 0xE0, 0x00,
      0x00, 0xF0, 0x00, 0x3A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x13, 0xC0, 0x01, 0xF0, 0x00,
      0x03, 0xC0, 0x01, 0xC1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x38, 0x00, 0x78, 0x00,
      0x07, 0x80, 0x0E, 0x01, 0x00, 0x00, 0x08, 0x00, 0x01, 0xC0, 0x00, 0x10, 0x06, 0x00, 0x18, 0x00,
      0x06, 0x00, 0x14, 0x00, 0x00, 0x00, 0x18, 0x00, 0x02, 0x20, 0x00, 0x00, 0x05, 0x80, 0x00, 0x00,
      0x00, 0x00, 0xE4, 0x00, 0x00, 0x00, 0x18, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x60, 0x00, 0x00,
      0x00, 0x03, 0x82, 0x00, 0x00, 0x00, 0x28, 0x00, 0x02, 0x00, 0x00, 0x00, 0x08, 0x18, 0x00, 0x00,
      0x00, 0x0C, 0x00, 0x07, 0x00, 0x00, 0x28, 0x00, 0x03, 0xC0, 0x00, 0x1C, 0x00, 0x06, 0x00, 0x00,
      0x00, 0x30, 0x00, 0x08, 0x80, 0x00, 0x48, 0x00, 0x02, 0x20, 0x00, 0x22, 0x00, 0x01, 0x80, 0x00,
      0x00, 0x50, 0x00, 0x00, 0x80, 0x00, 0x7C, 0x00, 0x02, 0x20, 0x00, 0x22, 0x00, 0x01, 0x40, 0x00,
      0x00, 0x08, 0x00, 0x00, 0x80, 0x00, 0x08, 0x00, 0x02, 0x20, 0x00, 0x22, 0x00, 0x02, 0x00, 0x00,
      0x00, 0x08, 0x00, 0x01, 0x00, 0x00, 0x08, 0x00, 0x01, 0xC0, 0x00, 0x1C, 0x00, 0x02, 0x00, 0x00,
      0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x00,
      0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x00,
      0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x00,
      0x00, 0x38, 0x00, 0x0F, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1C, 0x00, 0x04, 0x70, 0x00,
      0x00, 0x44, 0x00, 0x00, 0x00, 0x0A, 0x00, 0x40, 0x10, 0x00, 0x00, 0x00, 0x00, 0x1C, 0x88, 0x00,
      0x00, 0x44, 0x00, 0x00, 0x00, 0x0A, 0x00, 0x40, 0x10, 0x11, 0x00, 0x00, 0x00, 0x04, 0x88, 0x00,
      0x00, 0x44, 0x00, 0x00, 0x00, 0x0A, 0x00, 0x22, 0x20, 0x11, 0x00, 0x00, 0x00, 0x04, 0x88, 0x00,
      0x00, 0x44, 0x00, 0x00, 0x00, 0xFB, 0xE0, 0x22, 0x27, 0x3B, 0x9C, 0x00, 0x00, 0x04, 0x88, 0x00,
      0x00, 0x44, 0x00, 0x00, 0x01, 0x0A, 0x10, 0x22, 0x20, 0x91, 0x22, 0x00, 0x00, 0x04, 0x88, 0x00,
      0x00, 0x44, 0x00, 0x00, 0x01, 0x0A, 0x17, 0x15, 0x47, 0x91, 0x18, 0x00, 0x00, 0x04, 0x88, 0x00,
      0x00, 0x44, 0x00, 0x00, 0x01, 0x0A, 0x10, 0x15, 0x48, 0x91, 0x04, 0x00, 0x00, 0x04, 0x88, 0x00,
      0x00, 0x38, 0x00, 0x00, 0x01, 0x0A, 0x10, 0x08, 0x88, 0x91, 0x22, 0x00, 0x00, 0x04, 0x70, 0x00,
      0x00, 0x00, 0x00, 0x00, 0x00, 0xFB, 0xE0, 0x08, 0x87, 0x88, 0x9C, 0x00, 0x00, 0x00, 0x00, 0x00,
      0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
      0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
      0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
      0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
      0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
      0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
      0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
      };
      void setup()
      {
      unefois=true;
      pinMode(analogInput, INPUT); // analog input
      //display.begin(SSD1306_SWITCHCAPVCC, 0x3C); // needed for SH1306 display
      display.begin(SH1106_SWITCHCAPVCC, 0x3C);
      une_fois();
      display.clearDisplay(); // clears display from any library info displayed
      }
      void loop()
      {
      sample = analogRead(analogInput);
      if(SM.update())
      {
      sample = map(sample,0,1023,0,1000); // ajuste aiguil a max position defaut 95
      MeterValue = sample - 50; // ajuste aiguil a zero position defaut 50
      display.clearDisplay(); // refresh display for next step
      display.drawBitmap(0, 0, VUMeter, 128, 64, WHITE); // draws background
      int a1 = (hMeter + (sin(MeterValue / 57.296) * rMeter)); // meter needle horizontal coordinate
      int a2 = (vMeter - (cos(MeterValue / 57.296) * rMeter)); // meter needle vertical coordinate
      display.drawLine(a1, a2, hMeter, vMeter, WHITE); // draws needle
      display.display();
      }
      }
      //fonction
      void une_fois()
      {
      if(unefois)
      {
      float sensor = analogRead(A2);
      float volt = map(sensor, 0, 1023, 0, 5700); // calcul pour 0 - 30 volts avec resistance 10k et 100k
      //float volt = map(sensor, 0, 1023, 0, 500); // calcul pour 0 - 5 volts sans resistance
      display.setTextColor(WHITE);
      display.clearDisplay();
      display.setTextSize(2);
      display.setCursor(0, 10);
      display.print(volt/100,1); // explication: valeur diviser par 100 et (,1) pour afficher un chiffre apres le point
      display.print(" Volts");
      display.setCursor(25, 40);
      display.print("Meter");
      display.display();
      delay(3000);
      {
      unefois=false;
      }
      }
      }

    • @laurentconstantin4877
      @laurentconstantin4877 Рік тому +1

      @@ve2ydq345 merci beaucoup ....73's

    • @patrickarsac8601
      @patrickarsac8601 8 місяців тому

      Merci beaucoup pour le partage du code, je vais le modifier pour un S-mètre plus petit avec un écran 128x32.