New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
u8g2 and screen oled i2c 128x64 (screen empty) and 128x128 soon #644
Comments
All the u8g2 commands have to be encapsulated in a while loop:
|
Hello Code error ` Here my code modify //les librairies de l'écran // Déclaratipon de l'écran 128x64 //Déclaration de l'écran 128x128 // les 2 sondes DS18B20 void setup(void) // start serial port // Start up the library // déclaration de la pin 2 et 4 int readValEau = analogRead(2);// met à zéro la sonde EAU } void loop(void) // sonde EAU // sonde AIR /*/modele d'écriture // pour le voltage de la batterie //Affichage températures Air // Affichage températures Eau }` |
I made a false manipulation I am going to be frank, I am a big absolute beginner with arduino. You could modify it cleanly because I do not understand the arduino language and for the choice of screens and for the coding a lot as such EDIT : My error is modified |
Actually it looks better. Is it working now? It not, then please test your hardware setup with one of the u8g2 examples, which are shipped with the u8g2 library. |
I try this this night The code is like this ? int sensorValue = analogRead(A0); // A4 or A5 for me ? |
|
A GREAT thank you . Can you confirm the screen for oled 128 x 128 please .
The good code //les librairies de l'écran // Déclaratipon de l'écran 128x64 //Déclaration de l'écran 128x128 // les 2 sondes DS18B20 void setup(void) // start serial port // Start up the library // déclaration de la pin 2 et 4 int readValEau = analogRead(2);// met à zéro la sonde EAU void loop(void) int sensorValue = analogRead(A0); //A0 u8g2.firstPage();
} while ( u8g2.nextPage() ); }` |
The W128128 is still under construction. The Midas variant should be ok. |
Bonjour olikraus,
thank you for all
Patrick Lacroix, patrick.lacroix18@free.fr
28/06/2018
----- Message reçu -----
De : olikraus
À : olikraus/u8g2
Date : 2018-06-28, 00:26:15
Sujet : Re: [olikraus/u8g2] u8g2 and screen oled i2c 128x64 (screen empty)and 128x128 soon (#644)
The W128128 is still under construction. The Midas variant should be ok.
�
You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub, or mute the thread.
|
Hello or this code Question 2
You says me use too |
Question 1: Both forms should be the same. There is no difference. Question 2: In general: You should NOT use any analogRead(...) inside the u8g2.NextPage() while loop. |
my origin code is for print on screen the level of battery.
and says me use this too befor my code. |
As I said, there should be no analogRead(..) inside the u8g2-do-while loop at all. |
And then where I do have to put this code?
|
Outside the u8g2-do-while loop |
... I think this can be closed... |
Hello
I have this screen
https://fr.aliexpress.com/item/Free-shipping-Yellow-blue-double-color-128X64-OLED-LCD-LED-Display-Module-For-Arduino-0-96/32665937977.html?spm=a2g0s.9042311.0.0.X7TUdD
I connect my screen like this
VCC / 5v
GND / GND
SCL / A5
SDA / A4
I'll receveid this screen too soon
https://fr.aliexpress.com/item/Free-shipping-Yellow-blue-double-color-128X64-OLED-LCD-LED-Display-Module-For-Arduino-0-96/32665937977.html?spm=a2g0s.9042311.0.0.X7TUdD
I have this code. It compile but there is nothing on screen.
can you see this and say modify this for the 2 screens ?
It has been one week since I look
Thank you
My code don't work ( screen empty)
`// Pour l'écran
#include <Arduino.h>
#include <U8g2lib.h>
//Pour les sondes
#include <DallasTemperature.h> //DS18B20 pour température de l'eau et de l'air
#include <Wire.h>
//les librairies de l'écran
// pour les fontes https://github.com/olikraus/u8g2/wiki/fntlistall
// poue l'écran https://github.com/olikraus/u8g2/wiki/u8g2setupc
// Déclaratipon de l'écran 128x64
//U8G2_SSD1306_128X64_NONAME_2_SW_I2C u8g2(rotation, clock, data [, reset])
// U8G2_R0,SCL A5, SDA A4
U8G2_SSD1306_128X64_NONAME_2_SW_I2C u8g2 (U8G2_R0, A5, A4)
//Déclaration de l'écran 128x128
/*
U8G2_SSD1327_EA_W128128_1_SW_I2C u8g2(U8G2_R0, A5, A4);
ou le
U8G2_SSD1327_MIDAS_128X128_1_SW_I2C u8g2(U8G2_R0, A5, A4);
*/
// les 2 sondes DS18B20
#define ONE_WIRE_BUS_1 2 // sonde pour l'eau pin 2
#define ONE_WIRE_BUS_2 4 // sonde pour l'air pin 4
OneWire oneWire_in(ONE_WIRE_BUS_1); // sonde pour l'eau
OneWire oneWire_out(ONE_WIRE_BUS_2); // sonde pour l'air
DallasTemperature sensor_eau(&oneWire_in); // sonde pour l'eau
DallasTemperature sensor_air(&oneWire_out); // sonde pour l'air
void setup(void)
{
/* U8g2 Project: SSD1306 Test Board */
pinMode(A4, OUTPUT);
digitalWrite(A4, 0);
u8g2.begin();
u8g2.setPowerSave(0);
// start serial port
Serial.begin(9600);
Serial.println("Dallas Temperature Control Library Demo - TwoPin_DS18B20");
// Start up the library
sensor_eau.begin(); // sonde pour l'eau
sensor_air.begin(); // sonde pour l'air
// déclaration de la pin 2 et 4
pinMode(2, INPUT);
pinMode(4, INPUT);
int readValEau = analogRead(2);// met à zéro la sonde EAU
int readValAir = analogRead(4);// met à zéro la sonde AIR
}
void loop(void)
{
// AFFICHAGE SUR SERIAL
Serial.print("Recherche des temperatures...");
sensor_eau.requestTemperatures();
sensor_air.requestTemperatures();
Serial.println(" done");
// sonde EAU
Serial.print("Température eau: ");
Serial.println(sensor_eau.getTempCByIndex(0));
// sonde AIR
Serial.print("Température air: ");
Serial.println(sensor_air.getTempCByIndex(0));
delay ( 5000);
/*/modele d'écriture
u8g2.setFont(u8g2_font_ncenB14_tr);
u8g2.setCursor(0, 15);
u8g2.print("Hello World!");
*/
// Affichage Niveau batterie
u8g2.setFont(u8g2_font_ncenB14_tr);
u8g2.setCursor(0, 0);
u8g2.println("NIVEAU BATTERIE");
//delay ( 1000);
// pour le voltage de la batterie
// Conversion du signal (which goes from 0 - 1023) to a voltage (0 - (V):
int sensorValue = analogRead(A0);//******************************************************* A3 pour la voiture bateau
// écrit la valeur lue
float voltage = sensorValue * (5.0 / 1023.0);
u8g2.setCursor(0, 1);// position 0, sur la 1 ere ligne,
u8g2.print(" ");
u8g2.print(voltage);
u8g2.print("V");
//Affichage températures Air
u8g2.setFont(u8g2_font_chroma48medium8_r);
u8g2.setCursor(0, 3);
u8g2.println("TEMP. AIR ");
u8g2.print(" ");
u8g2.print(sensor_air.getTempCByIndex(0));
u8g2.print(" ");
u8g2.print("C");
// Affichage températures Eau
u8g2.setFont(u8g2_font_ncenB14_tr);
u8g2.setCursor(0, 6);
u8g2.println("TEMP. EAU ");
u8g2.print(" ");
u8g2.print(sensor_eau.getTempCByIndex(0));
u8g2.print(" ");
u8g2.print("C");
}`
The text was updated successfully, but these errors were encountered: