src/main.cpp:95:1: error: expected ‘}’ at end of input
}
^
In file included from src/main.cpp:19:
src/Bounce.h:25:1: note: to match this ‘{’
{
^
src/main.cpp:95:1: error: expected unqualified-id at end of input
}
^
The code im writing goes as:
void loop()
{
bool bLED= 0;
double fps = 0;
BouncingBallEffect balls(NUM_LEDS, 1);
while (true)
{
bLED = !bLED;
digitalWrite(LED_BUILTIN, bLED);
double dStart = millis() / 1000.0; //display frame rate and calc how long it takes
// Draw LED here
balls.Draw();
for (int i = 9; i< NUM_LEDS; i ++) // WARNING Be sure to LIMIT POWER
g_LEDS[i] = CRGB::White;
//Handle OLED Drawing
uint32_t milliwatts = calculate_unscaled_power_mW(g_LEDs, NUM_LEDS); // hOW MUCCH POER WE PULLING
static unsigned long msLastUpdate = millis();
if (millis() - msLastUpdate > 100)
{
g_OLED.clearBuffer();
g_OLED.setCursor(0, g_lineHeight);
g_OLED.printf("FPS : %.1lf", fps);
g_OLED.setCursor(0, g_lineHeight * 2);
g_OLED.printf("Power; %u mW", milliwatts);
g_OLED.sendBuffer(); msLastUpdate = millis();
}
FastLED.show(g_Brightness);
double dEnd = millis() / 1000.0;
fps = FramePerSecond(dEnd - dStart);
}
}
#include <Arduino.h> //Arduino Framework
#include <U8g2lib.h> // For text on OLED
#define FASTLED_INTERNAL // Surpress build banner
#include <FastLED.h> // FastLED Lib
#define OLED_CLOCK 15 //Pins For the OLED Display
#define OLED_DATA 4
#define OLED_RESET 16
#define NUM_LEDS 172 //FastLED definitions
#define LED_PIN 5
CRGB g_LEDs[NUM_LEDS] = {0}; //Frame buffer for FastLED
U8G2_SSD1306_128X64_NONAME_F_HW_I2C g_OLED(U8G2_R2, OLED_RESET, OLED_CLOCK, OLED_DATA);
int g_lineHeight = 0;
int g_Brightness = 255; // 0-255 brightness scale
#include "Bounce.h"
// Frames Per Second
//
//Tracks a weigth average in order to smooth out the values that is given. Computes the FPS as the simple reciprocal
// of the amount of time taken specified by the caller. So 1/3 of a second is 3fps, and it
// will take 10 frames or so to stablize that value.
double FramePerSecond(double seconds)
{
static double framesPerSecond;
framesPerSecond = (framesPerSecond * 0.9) + (1.0 / seconds * 0.1);
return framesPerSecond;
}
void setup()
{
pinMode(LED_BUILTIN, OUTPUT);
pinMode(LED_PIN, OUTPUT);
Serial.begin(115200);
while (!Serial) { }
Serial.println("ESP32 Startup");
g_OLED.begin();
g_OLED.clear();
g_OLED.setFont(u8g2_font_profont15_tf);
g_lineHeight = g_OLED.getFontAscent() - g_OLED.getFontDescent(); //Descent is a negative number so we add it to the total
FastLED.addLeds<WS2812B, LED_PIN, GRB>(g_LEDs, NUM_LEDS); //Add our LED strip to the FastLED Library
FastLED.setBrightness(255);
FastLED.setMaxPowerInMilliWatts(900);
}
void loop()
{
bool bLED= 0;
double fps = 0;
BouncingBallEffect balls(NUM_LEDS, 1);
while (true)
{
bLED = !bLED;
digitalWrite(LED_BUILTIN, bLED);
double dStart = millis() / 1000.0; //display frame rate and calc how long it takes
// Draw LED here
balls.Draw();
//Handle OLED Drawing
uint32_t milliwatts = calculate_unscaled_power_mW(g_LEDs, NUM_LEDS); // hOW MUCCH POER WE PULLING
static unsigned long msLastUpdate = millis();
if (millis() - msLastUpdate > 100)
{
g_OLED.clearBuffer();
g_OLED.setCursor(0, g_lineHeight);
g_OLED.printf("FPS : %.1lf", fps);
g_OLED.setCursor(0, g_lineHeight * 2);
g_OLED.printf("Power; %u mW", milliwatts);
g_OLED.sendBuffer(); msLastUpdate = millis();
}
FastLED.show(g_Brightness);
double dEnd = millis() / 1000.0;
fps = FramePerSecond(dEnd - dStart);
}
}
This function is not closed correctly. First of all the indentation is wrong, eveything after the for loop is one level to deep, second of all the function is not closed with a } properly. The final }; closes the class.
So just modify the code starting at the draw function to