Why wont this sketch verify? can anyone fix this?

I know some coding but not enough to build a code solo, can anyone help me fix this code so it will verify?

// Adafruit-GFX-Library - Version: Latest
#include <Adafruit_GFX.h>
#include <Adafruit_SPITFT.h>
#include <Adafruit_SPITFT_Macros.h>
#include <gfxfont.h>

// Adafruit_SSD1306 - Version: Latest
#include <Adafruit_SSD1306.h>

const byte buttonpin = 3;
const byte pinny = 2;
const byte pindo = 4;
const byte OLED_RESET = 4; // not used / nicht genutzt bei diesem Display
Adafruit_SSD1306 display(OLED_RESET);

void setup()
{
pinMode(13, OUTPUT);

pinMode(buttonpin, INPUT_PULLUP);
// initialize with the I2C addr 0x3C / mit I2C-Adresse 0x3c initialisieren
display.begin(SSD1306_SWITCHCAPVCC, 0x3c);

pinMode(pinny, INPUT_PULLUP);
// initialize with the I2C addr 0x3C / mit I2C-Adresse 0x3c initialisieren
display.begin(SSD1306_SWITCHCAPVCC, 0x3c);

pinMode(pindo, INPUT_PULLUP);
// initialize with the I2C addr 0x3C / mit I2C-Adresse 0x3c initialisieren
display.begin(SSD1306_SWITCHCAPVCC, 0x3c);

Serial.begin(9600);
display.clearDisplay();
display.display();
delay(2000);
display.clearDisplay();

display.setTextColor(INVERSE);
}

void loop()
{
if (digitalRead(buttonpin) == LOW)
{
display.clearDisplay();
display.setCursor(41,20);
display.setTextSize(1);
display.print("");
display.setCursor(32,20);
display.setTextSize(0);
display.print(“Welcome”);
}
else
{
display.clearDisplay();
}

display.display();
{
if (digitalRead(pinny) == LOW)
{
display.clearDisplay();
display.setCursor(41,20);
display.setTextSize(1);
display.print("");
display.setCursor(32,20);
display.setTextSize(0);
display.print(“goodbye world”);
}
else
{
display.clearDisplay();
}

display.display();
{
if (digitalRead(pindo) == LOW)
{
display.clearDisplay();
display.setCursor(41,20);
display.setTextSize(1);
display.print("");
display.setCursor(32,20);
display.setTextSize(0);
display.print(“hello world”);
}
else
{
display.clearDisplay();
}

display.display();
{
}

display.display(); { }

That doesn’t look good ;)

1) Learn how to post code on the forum using code tags

2) Learn how to properly indent code; use of tools -> autoformat in the IDE is a great help for that. After that, the end of your code looks like

      display.display();
      {
      }

The last } should be at the beginning of a line after the autoformat; if it isn't, you have a mismatch in { and }.

Why do you have that { everywhere after display.display()?

  display.display();
  {

Remove them and your good to go.

sterretje

I'm not really one who knows how to code very well I'm like a beginner, could you possibly show me how this is done in the sketch I've given? If not, could you tell me where this tool is located? Im using the online ide for this. :confused:

The Arduino Web Editor doesn't have the very useful Auto Format feature, which would make it much easier for you to find this sort of bug. I recommend you to use the real Arduino IDE if possible. You can download it for free from here: http://www.arduino.cc/en/Main/Software

Hi,
Welcome to the forum.

Please read the first post in any forum entitled how to use this forum.
http://forum.arduino.cc/index.php/topic,148850.0.html then look down to item #7 about how to post your code.
It will be formatted in a scrolling window that makes it easier to read.

What model Arduino are you using?

Thanks… Tom… :slight_smile:

Just remove every { directly after display.display()

  display.display();
  {                <<================= remove

Zackypoo:
sterretje

I’m not really one who knows how to code very well I’m like a beginner, could you possibly show me how this is done in the sketch I’ve given? If not, could you tell me where this tool is located? Im using the online ide for this. :confused:

Is this a school project?
If you are a beginner than this is not the code to try and get going.
Do you understand the use of libraries and how to input and output with code?
Have you written any code?
Tom… :slight_smile:

sterretje

It worked thanks you very much! really appreciate your help! :D