Ovdje pročitajte kako se registrirati na forum.

Problem sa OLED kodom

Tehnička podrška za sve module i aktuatore iz ponude e-radionica.com
Odgovorite
advancedgwt#3012
Ozbiljni hardveraš
Ozbiljni hardveraš
Postovi: 115
Pridružen/a: pon lip 11, 2018 12:42 pm

Problem sa OLED kodom

Post Postao/la advancedgwt#3012 » uto lis 22, 2019 12:52 pm

Zdravo,

Sastavio sam prema KKM OLED i kad hocu da kompajliram dobijem sledecu gresku

Kod: Označite sve

Arduino: 1.8.5 (Windows 10), Board: "Arduino Nano, ATmega328P"



OLED1:20: error: could not convert 'display.Adafruit_SSD1306::begin(2u, 60u, true)' from 'void' to 'bool'

 if(!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) { // Adresa 0x3C za 128x32 displej

                                             ^

OLED1:20: error: in argument to unary !

Using library Wire at version 1.0 in folder: C:\Users\dkaludjerovic\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.6.207\libraries\Wire 
Using library Adafruit_SSD1306-master at version 1.1.2 in folder: C:\Users\dkaludjerovic\Documents\Arduino\libraries\Adafruit_SSD1306-master 
Using library SPI at version 1.0 in folder: C:\Users\dkaludjerovic\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.6.207\libraries\SPI 
Using library Adafruit-GFX-Library-master at version 1.2.9 in folder: C:\Users\dkaludjerovic\Documents\Arduino\libraries\Adafruit-GFX-Library-master 
Using library DHT-sensor-library-master at version 1.3.7 in folder: C:\Users\dkaludjerovic\Documents\Arduino\libraries\DHT-sensor-library-master 
Using library Adafruit_Sensor-master at version 1.0.2 in folder: C:\Users\dkaludjerovic\Documents\Arduino\libraries\Adafruit_Sensor-master 
exit status 1
could not convert 'display.Adafruit_SSD1306::begin(2u, 60u, true)' from 'void' to 'bool'
Avatar
david.zovko#4501
e-radionica.com team
e-radionica.com team
Postovi: 262
Pridružen/a: ned tra 15, 2018 2:59 pm
Lokacija: Osijek, Croatia
Kontakt:

Re: Problem sa OLED kodom

Post Postao/la david.zovko#4501 » sri lis 23, 2019 8:25 am

Pozdrav

radi se o OLED 128x32?

Ovaj KKM: https://e-radionica.com/hr/blog/2019/09 ... ed-128x32/ ?
advancedgwt#3012
Ozbiljni hardveraš
Ozbiljni hardveraš
Postovi: 115
Pridružen/a: pon lip 11, 2018 12:42 pm

Re: Problem sa OLED kodom

Post Postao/la advancedgwt#3012 » sri lis 23, 2019 6:50 pm

Da, taj mi je stigao pre par dana
Avatar
david.zovko#4501
e-radionica.com team
e-radionica.com team
Postovi: 262
Pridružen/a: ned tra 15, 2018 2:59 pm
Lokacija: Osijek, Croatia
Kontakt:

Re: Problem sa OLED kodom

Post Postao/la david.zovko#4501 » čet lis 24, 2019 8:35 am

Dragane

molim te provjeri, nanovo restartiraj računalo i otvori novi kod u Arduino IDE, meni se oba primjera iz KKM-a uredno compileaju i uploadaju.
advancedgwt#3012
Ozbiljni hardveraš
Ozbiljni hardveraš
Postovi: 115
Pridružen/a: pon lip 11, 2018 12:42 pm

Re: Problem sa OLED kodom

Post Postao/la advancedgwt#3012 » pet lis 25, 2019 11:43 am

Probacu, simpatican je taj mali OLED.
advancedgwt#3012
Ozbiljni hardveraš
Ozbiljni hardveraš
Postovi: 115
Pridružen/a: pon lip 11, 2018 12:42 pm

Re: Problem sa OLED kodom

Post Postao/la advancedgwt#3012 » pet lis 25, 2019 1:33 pm

Opet isto, ova linija je problem

if(!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) { // Adresa 0x3C za 128x32 displej
Avatar
david.zovko#4501
e-radionica.com team
e-radionica.com team
Postovi: 262
Pridružen/a: ned tra 15, 2018 2:59 pm
Lokacija: Osijek, Croatia
Kontakt:

Re: Problem sa OLED kodom

Post Postao/la david.zovko#4501 » pon lis 28, 2019 9:27 am

Molim te screenshot Tools izbornika iz Arduino IDE (Gdje se vidi koja je ploča odabrana i ostale opcije)

A također, c/p cijele greške koju dobivaš. Ako si nešto mijenjao u kodu, molim te i kod
advancedgwt#3012
Ozbiljni hardveraš
Ozbiljni hardveraš
Postovi: 115
Pridružen/a: pon lip 11, 2018 12:42 pm

Re: Problem sa OLED kodom

Post Postao/la advancedgwt#3012 » pon lis 28, 2019 6:23 pm

Evo prvo ovo


slika
advancedgwt#3012
Ozbiljni hardveraš
Ozbiljni hardveraš
Postovi: 115
Pridružen/a: pon lip 11, 2018 12:42 pm

Re: Problem sa OLED kodom

Post Postao/la advancedgwt#3012 » pon lis 28, 2019 6:24 pm

Nisam nista menjao u kodu.
Avatar
david.zovko#4501
e-radionica.com team
e-radionica.com team
Postovi: 262
Pridružen/a: ned tra 15, 2018 2:59 pm
Lokacija: Osijek, Croatia
Kontakt:

Re: Problem sa OLED kodom

Post Postao/la david.zovko#4501 » sri lis 30, 2019 2:31 pm

Processor ti mora biti "Atmega328P (Old Bootloader)"
Port ćeš odabrati kada spojiš pločicu

Jel radi tako?
advancedgwt#3012
Ozbiljni hardveraš
Ozbiljni hardveraš
Postovi: 115
Pridružen/a: pon lip 11, 2018 12:42 pm

Re: Problem sa OLED kodom

Post Postao/la advancedgwt#3012 » čet lis 31, 2019 11:22 am

Ne tako je bilo od pocetka
advancedgwt#3012
Ozbiljni hardveraš
Ozbiljni hardveraš
Postovi: 115
Pridružen/a: pon lip 11, 2018 12:42 pm

Re: Problem sa OLED kodom

Post Postao/la advancedgwt#3012 » sub stu 02, 2019 3:17 pm

Davide,
Sad sam proverio, u Arduino IDE uopste nemam opciju za old bootloader
advancedgwt#3012
Ozbiljni hardveraš
Ozbiljni hardveraš
Postovi: 115
Pridružen/a: pon lip 11, 2018 12:42 pm

Re: Problem sa OLED kodom

Post Postao/la advancedgwt#3012 » pon stu 04, 2019 8:45 pm

Error.jpg
Instalirao sam sve na drugom kompjuteru i dobio ovo




advancedgwt#7982 je napisao/la:
sub stu 02, 2019 3:17 pm
Davide,
Sad sam proverio, u Arduino IDE uopste nemam opciju za old bootloader
advancedgwt#3012
Ozbiljni hardveraš
Ozbiljni hardveraš
Postovi: 115
Pridružen/a: pon lip 11, 2018 12:42 pm

Re: Problem sa OLED kodom

Post Postao/la advancedgwt#3012 » sub stu 09, 2019 10:38 pm

Resio sam ovaj problem iz prethodne poruke ali opet mi se javlja ista greska i na drugom kompjuteru.

Da li imate negde I2C scanner?
domagoj#4345
Ozbiljni hardveraš
Ozbiljni hardveraš
Postovi: 89
Pridružen/a: ned tra 15, 2018 2:59 pm
Lokacija: Zagreb

Re: Problem sa OLED kodom

Post Postao/la domagoj#4345 » sub stu 09, 2019 10:41 pm

Evo ga.

Kod: Označite sve

/**
 * I2CScanner.ino -- I2C bus scanner for Arduino
 *
 * 2009,2014, Tod E. Kurt, http://todbot.com/blog/
 *
 */

#include "Wire.h"
extern "C" { 
#include "utility/twi.h"  // from Wire library, so we can do bus scanning
}

// Scan the I2C bus between addresses from_addr and to_addr.
// On each address, call the callback function with the address and result.
// If result==0, address was found, otherwise, address wasn't found
// (can use result to potentially get other status on the I2C bus, see twi.c)
// Assumes Wire.begin() has already been called
void scanI2CBus(byte from_addr, byte to_addr, 
                void(*callback)(byte address, byte result) ) 
{
  byte rc;
  byte data = 0; // not used, just an address to feed to twi_writeTo()
  for( byte addr = from_addr; addr <= to_addr; addr++ ) {
    rc = twi_writeTo(addr, &data, 0, 1, 0);
    callback( addr, rc );
  }
}

// Called when address is found in scanI2CBus()
// Feel free to change this as needed
// (like adding I2C comm code to figure out what kind of I2C device is there)
void scanFunc( byte addr, byte result ) {
  Serial.print("addr: ");
  Serial.print(addr,DEC);
  Serial.print( (result==0) ? " found!":"       ");
  Serial.print( (addr%4) ? "\t":"\n");
}


byte start_address = 8;       // lower addresses are reserved to prevent conflicts with other protocols
byte end_address = 119;       // higher addresses unlock other modes, like 10-bit addressing

// standard Arduino setup()
void setup()
{
    Wire.begin();

    Serial.begin(9600);                   // Changed from 19200 to 9600 which seems to be default for Arduino serial monitor
    Serial.println("\nI2CScanner ready!");

    Serial.print("starting scanning of I2C bus from ");
    Serial.print(start_address,DEC);
    Serial.print(" to ");
    Serial.print(end_address,DEC);
    Serial.println("...");

    // start the scan, will call "scanFunc()" on result from each address
    scanI2CBus( start_address, end_address, scanFunc );

    Serial.println("\ndone");
    
    // Set pin mode so the loop code works ( Not required for the functionality)
    pinMode(13, OUTPUT);
}

// standard Arduino loop()
void loop() 
{
    // Nothing to do here, so we'll just blink the built-in LED
    digitalWrite(13,HIGH);
    delay(300);
    digitalWrite(13,LOW);
    delay(300);
}
Pozdrav, Domagoj
Odgovorite