Hi, I recently got a pressure sensor:CP24 / Nyomásérzékelő, 0,2-100N (IEE) - HESTORE - Elektronikai alkatrész kis- és nagykereskedelem
It only has 2 legs, so i dnot know wich is ground, 5v, and the data.
I'm trying to implement it in this code:
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
// Set the LCD address to 0x27 for a 16 chars and 2 line display
LiquidCrystal_I2C lcd(0x27, 16, 2);
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#define SCREEN_WIDTH 128 // OLED display width, in pixels
#define SCREEN_HEIGHT 64 // OLED display height, in pixels
// Declaration for an SSD1306 display connected to I2C (SDA, SCL pins)
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, -1);
void setup()
{
Serial.begin(115200);
if(!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) { // Address 0x3D for 128x64
Serial.println(F("SSD1306 allocation failed"));
for(;;);
}
// initialize the LCD
lcd.begin();
pinMode(13, OUTPUT); // sets the digital pin 13 as output
// Turn on the blacklight
lcd.setBacklight((uint8_t)1);
lcd.print("Hello, world");
delay(1000);
lcd.clear();
lcd.print("Hello, world.");
delay(1000);
lcd.clear();
lcd.print("Hello, world..");
delay(1000);
lcd.clear();
lcd.print("Hello, world...");
delay(1000);
lcd.clear();
lcd.print("Oled inditasa...");
delay(random(1000,2000));
lcd.clear();
display.clearDisplay();
display.setTextSize(1.5);
display.setTextColor(WHITE);
display.setCursor(0, 10);
// Display static text
display.println(" Waiting for task...");
display.println(" Waiting for task...");
display.println(" Waiting for task...");
display.println(" Waiting for task...");
display.println(" Waiting for task...");
display.println(" Waiting for task...");
display.display();
delay(random(100,2000));
lcd.print("Hutes teszt...");
digitalWrite(13,HIGH);
delay(random(7000,10000));
digitalWrite(13,LOW);
lcd.clear();
lcd.print("Nyomas szenzor");
lcd.setCursor(0,1);
lcd.print("kalibralasa...");
delay(random(1000,5000));
lcd.clear();
lcd.setCursor(0,0);
digitalWrite(13,HIGH);
}
void loop()
{
}