Remi B
Posts: 11
Joined: Mon Aug 27, 2018 7:22 pm

LCD I2C Langage C/C++

Mon Sep 24, 2018 6:16 pm

Bonjour,
Je possède un écran LCD sur lequel j'ai ajouté une puce pour l'avoir en I2C

https://www.amazon.fr/SODIAL-dinterface ... 1915&psc=1

https://www.amazon.fr/1602-Module-LCD-r ... rds=QAPASS

J'ai trouvé du code sur internet pour le langage C mais celui-ci éteint mon écran

Code: Select all

#include <stdio.h>
#include <unistd.h>
#include <wiringPi.h>
#include <wiringPiI2C.h>

int main ()
{
	int fd;
	
	//Initialisation de la bibliothèque wiringPi
	
    wiringPiSetup () ;
    
	//On associe à fd (file device) le port I2C dont l'adresse est spécifiée en attribut)
	
    if ((fd = wiringPiI2CSetup(0x27)) < 0)		printf("I2CSetup Failed, %i\n", fd);
	
	wiringPiI2CWriteReg16(fd, 0x00, 0xfff);
	wiringPiI2CWrite(fd, 0xfff);
   
    close(fd);
   
    return 0;
}
Si quelqu'un aurait un exemple à me proposer je suis pour. C'est pour le rajouter dans un programme en C donc si vous plaît pas de Python.

Merci d'avance!

User avatar
DougieLawson
Posts: 38883
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: LCD I2C Langage C/C++

Mon Sep 24, 2018 8:49 pm

Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

totoharibo
Posts: 4437
Joined: Thu Jan 24, 2013 8:43 am

Re: LCD I2C Langage C/C++

Tue Sep 25, 2018 7:56 am

j'ai utilisé ça et ça a marché
https://github.com/Freenove/Freenove_LC ... spberry_Pi

un petit i2cdetect pour voir si les adresses correspondent ?

Manu66
Posts: 38
Joined: Tue Sep 11, 2018 3:20 pm

Re: LCD I2C Langage C/C++

Wed Sep 26, 2018 5:50 pm

Salut
Pour lecture je l' ai vu par hasard cours pour te lancé : http://herve.hollard.perso.sfr.fr/prog_pic_c.htm

Enfin pour l'USART : http://fabrice.sincere.pagesperso-or...8/usart628.htm
Bonne chance

Remi B
Posts: 11
Joined: Mon Aug 27, 2018 7:22 pm

Re: LCD I2C Langage C/C++

Wed Sep 26, 2018 6:10 pm

Ok super tu fonctionne très bien merci beaucoup.
Je vous remercie de m'avoir répondu si vite.

Manu66
Posts: 38
Joined: Tue Sep 11, 2018 3:20 pm

Re: LCD I2C Langage C/C++

Sat Sep 29, 2018 5:08 pm

Bonsoir
C'est un plaisir, à la prochaine.
Bonne continuation!

Return to “Français”