Stranica: 1/1.
Problem sa OLED kodom
Postano: uto lis 22, 2019 12:52 pm
Postao/la advancedgwt#3717
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'
Re: Problem sa OLED kodom
Postano: sri lis 23, 2019 8:25 am
Postao/la david.zovko#1157
Re: Problem sa OLED kodom
Postano: sri lis 23, 2019 6:50 pm
Postao/la advancedgwt#3717
Da, taj mi je stigao pre par dana
Re: Problem sa OLED kodom
Postano: čet lis 24, 2019 8:35 am
Postao/la david.zovko#1157
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.
Re: Problem sa OLED kodom
Postano: pet lis 25, 2019 11:43 am
Postao/la advancedgwt#3717
Probacu, simpatican je taj mali OLED.
Re: Problem sa OLED kodom
Postano: pet lis 25, 2019 1:33 pm
Postao/la advancedgwt#3717
Opet isto, ova linija je problem
if(!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) { // Adresa 0x3C za 128x32 displej
Re: Problem sa OLED kodom
Postano: pon lis 28, 2019 9:27 am
Postao/la david.zovko#1157
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
Re: Problem sa OLED kodom
Postano: pon lis 28, 2019 6:23 pm
Postao/la advancedgwt#3717
Evo prvo ovo

Re: Problem sa OLED kodom
Postano: pon lis 28, 2019 6:24 pm
Postao/la advancedgwt#3717
Nisam nista menjao u kodu.
Re: Problem sa OLED kodom
Postano: sri lis 30, 2019 2:31 pm
Postao/la david.zovko#1157
Processor ti mora biti "Atmega328P (Old Bootloader)"
Port ćeš odabrati kada spojiš pločicu
Jel radi tako?
Re: Problem sa OLED kodom
Postano: čet lis 31, 2019 11:22 am
Postao/la advancedgwt#3717
Ne tako je bilo od pocetka
Re: Problem sa OLED kodom
Postano: sub stu 02, 2019 3:17 pm
Postao/la advancedgwt#3717
Davide,
Sad sam proverio, u Arduino IDE uopste nemam opciju za old bootloader
Re: Problem sa OLED kodom
Postano: pon stu 04, 2019 8:45 pm
Postao/la advancedgwt#3717
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
Re: Problem sa OLED kodom
Postano: sub stu 09, 2019 10:38 pm
Postao/la advancedgwt#3717
Resio sam ovaj problem iz prethodne poruke ali opet mi se javlja ista greska i na drugom kompjuteru.
Da li imate negde I2C scanner?
Re: Problem sa OLED kodom
Postano: sub stu 09, 2019 10:41 pm
Postao/la domagoj#3470
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