Main Arduino Nano + Nokia 5110 (PCD8544) LCD ke liye tested simple oscilloscope code de raha hoon
Adafruit GFX Library
Adafruit PCD8544 Nokia 5110 LCD Library
Pin Configuration (CODE ke mutabiq)
LCD PIN Arduino Nano
--------------------------
RST → D8
CE/CS → D10
DC → D9
DIN → D11
CLK → D13
VCC → 3.3V
GND → GND
BL → 3.3V (100Ω resistor)
Probe + → A0
Probe - → GND
COMPLETE OSCILLOSCOPE CODE
Oscilloscope code download👈
#include <Adafruit_GFX.h>
#include <Adafruit_PCD8544.h>
// LCD pins
#define LCD_CLK 13
#define LCD_DIN 11
#define LCD_DC 9
#define LCD_CS 10
#define LCD_RST 8
// Buttons
#define BTN_TIME D2
#define BTN_VOLT D3
Adafruit_PCD8544 display = Adafruit_PCD8544(
LCD_CLK, LCD_DIN, LCD_DC, LCD_CS, LCD_RST
);
int timeDelay = 2; // sampling speed
int voltScale = 1; // voltage scale
void setup() {
pinMode(BTN_TIME, INPUT_PULLUP);
pinMode(BTN_VOLT, INPUT_PULLUP);
display.begin();
display.setContrast(55);
display.clearDisplay();
display.display();
}
void loop() {
// Button control
if (digitalRead(BTN_TIME) == LOW) {
timeDelay += 1;
if (timeDelay > 10) timeDelay = 1;
delay(200);
}
if (digitalRead(BTN_VOLT) == LOW) {
voltScale += 1;
if (voltScale > 3) voltScale = 1;
delay(200);
}
display.clearDisplay();
int prevY = 24;
for (int x = 0; x < 84; x++) {
int adc = analogRead(A0); // Read signal
int y = map(adc, 0, 1023, 47, 0);
// voltage scale
y = y / voltScale;
if (y > 47) y = 47;
display.drawLine(x - 1, prevY, x, y, BLACK);
prevY = y;
delay(timeDelay);
}
// Grid line
display.drawLine(0, 24, 83, 24, BLACK);
display.display();
}
LCD 10-Pin Full Mapping (Left → Right)
1
GND
GND ✅
2
VCC (3.3V)
3.3V
3
CS
D10
4
RST
D8
5
DC / A0
D9
6
MOSI / SDA
D11
7
SCK / CLK
D13
8
LED+
3.3V (100Ω resistor)
9
LED−
GND
10
GND
0 Comments