1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85
| #include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
Adafruit_SSD1306 display(4) ;
float Mesuretension ;
float tension ;
float tension1 ;
void setup() {
// put your setup code here, to run once:
Serial.begin (9600) ;
display.begin (SSD1306_SWITCHCAPVCC, 0X3C) ;
display.setTextSize (2) ;
display.setTextColor (WHITE) ;
pinMode (A0 ,INPUT) ;
}
void loop() {
Mesuretension =analogRead (A0) ;
// put your main code here, to run repeatedly:
tension =(Mesuretension*5)/1023 ;
{
if ( tension > 2 )
if ( tension < 3 )
{
display.clearDisplay () ;
display.setCursor (0,0) ;
display.println (tension) ;
display.display () ;
delay (1000) ;
}}}
* Created by ArduinoGetStarted.com
*
* This example code is in the public domain
*
* Tutorial page: <a href="https://arduinogetstarted.com/tutorials/arduino-gps" target="_blank">https://arduinogetstarted.com/tutorials/arduino-gps</a>
*/
#include <TinyGPS++.h>
#include <SoftwareSerial.h>
#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
Adafruit_SSD1306 display(5) ;
const int RXPin = 2, TXPin = 3;
const uint32_t GPSBaud = 9600; //Default baud of NEO-6M is 9600
TinyGPSPlus gps; // the TinyGPS++ object
SoftwareSerial gpsSerial(RXPin, TXPin); // the serial interface to the GPS device
void setup() {
Serial.begin(9600);
gpsSerial.begin(GPSBaud);
// put your setup code here, to run once:
Serial.begin (9600) ;
display.begin (SSD1306_SWITCHCAPVCC, 0X3C) ;
display.setTextSize (3) ;
display.setTextColor (WHITE) ;
}
void loop() {
if (gpsSerial.available() > 0) {
if (gps.encode(gpsSerial.read())) {
//display.print(F("- speed: "));
if (gps.speed.isValid()) {
display.clearDisplay () ;
display.setCursor (0,0) ;
display.print(gps.speed.kmph());
display.display () ;
//delay (1000) ;
}}}} |
Partager