WHat does error 302 mean and what is the way to fix it?
Code is attached
Arduino.txt (2.96 KB)
you need to open your code with another more capable text editor (showing invisible chars) and hunt for "weird" characters.. you have plenty of them...
find one - and do a find and replace with a space
I did the modification in the attached file, give it a try (I don't have the rest of your code so could not try to compile)
Arduino.txt (2.96 KB)
Ok, I have fixed the weird characters that you pointed out. However, there is still an error (stray '\302' in program) with the line "Adafruit_ST7735 tft = Adafruit_ST7735(cs, dc, mosi, sclk, rst);" highlighted.
How hard to understand is "Post your code" ?
// copy the sketch below and paste it into the Arduino IDE compile and run the program.
// this sketch was created using code from both the adafruit and the Braintest( by Eric Mika, 2010 ) sample sketches
// You can use any (4 or) 5 pins
#define sclk 4
#define mosi 5
#define cs 6
#define dc 7
#define rst 8 // you can also connect this to the Arduino reset
#define ANALOG_IN 0 // for cds light sensor
#define ANALOG_IN 1 // for temperature sensor
#include <Adafruit_GFX.h> // Core graphics library
#include <Adafruit_ST7735.h> // Hardware-specific library
#include <SPI.h>
#include <Brain.h>
Adafruit_ST7735 tft = Adafruit_ST7735(cs, dc, mosi, sclk, rst);
// Set up the brain parser, pass it the hardware serial object you want to listen on.
Brain brain(Serial);
void setup(void) {
tft.initR(INITR_BLACKTAB); // initialize a ST7735S chip, black tab
// Start the hardware serial.
Serial.begin(9600);
// tft.setCursor(0, 30);
// tft.setTextColor(ST7735_RED);
tft.fillScreen(ST7735_BLACK);
tft.drawLine(0, 50, tft.width()-1, 50, ST7735_WHITE);
tft.setCursor(0, 60);
tft.setTextColor(ST7735_YELLOW);
tft.println("Body Temp : ");
tft.setTextColor(ST7735_RED);
tft.println("Heart Rate: ");
tft.setTextColor(ST7735_GREEN);
tft.println("GSR VAL : ");
tft.setTextColor(ST7735_YELLOW);
tft.println("EEG signal: ");
tft.setTextColor(ST7735_WHITE);
tft.println("Attention : ");
tft.setTextColor(ST7735_WHITE);
tft.println("Meditation: ");
tft.drawLine(0, 110, tft.width()-1, 110, ST7735_WHITE);
}
void loop() {
// tft.fillScreen(ST7735_BLACK); // clear screen
//delay(2000);
//tft.setTextColor(ST7735_GREEN, ST7735_BLACK);
//tft.println((float)DHT11.temperature,1);
//tft.setTextColor(ST7735_GREEN, ST7735_BLACK);
//tft.println((float)DHT11.humidity,1);
//tft.setTextColor(ST7735_GREEN, ST7735_BLACK);
// tft.println(DHT11.fahrenheit(), 1);
// tft.print(" ");
//tft.setTextColor(ST7735_GREEN, ST7735_BLACK);
// tft.println(DHT11.kelvin(), 1);
//tft.setTextColor(ST7735_GREEN, ST7735_BLACK);
//tft.println(DHT11.dewPoint(), 1);
//tft.setTextColor(ST7735_GREEN, ST7735_BLACK);
//tft.println(DHT11.dewPointFast(), 1);
// tft.setCursor(0,115);
// tft.print("Light intensity ");
//int val = analogRead(ANALOG_IN); // READ LIGHT SENSOR VALUE
//tft.setCursor(60, 130);
// tft.setTextColor(ST7735_YELLOW, ST7735_BLACK);
// tft.println(val, 1); // PRINT LIGHT SENSOR VALUE
//delay(2000);
tft.setCursor(0, 115);
tft.setTextSize(1);
tft.setTextColor(ST7735_YELLOW,ST7735_BLACK );
// Expect packets about once per second.
// The .readCSV() function returns a string (well, char*) listing the most recent brain data, in the following format:
// "signal strength, attention, meditation, delta, theta, low alpha, high alpha, low beta, high beta, low gamma, high gamma"
if (brain.update()) {
//tft.println(brain.readErrors());
tft.println(brain.readCSV());
}}
{facepalm}
Followed the instructions from #7 and "Code-Tagged" the code below. Sorry i'm new to this forum, so wasnt aware. THANK YOU for all your help & support.
// copy the sketch below and paste it into the Arduino IDE compile and run the program.
// this sketch was created using code from both the adafruit and the Braintest( by Eric Mika, 2010 ) sample sketches
// You can use any (4 or) 5 pins
#define sclk 4
#define mosi 5
#define cs 6
#define dc 7
#define rst 8 // you can also connect this to the Arduino reset
#define ANALOG_IN 0 // for cds light sensor
#define ANALOG_IN 1 // for temperature sensor
#include <Adafruit_GFX.h> // Core graphics library
#include <Adafruit_ST7735.h> // Hardware-specific library
#include <SPI.h>
#include <Brain.h>
Adafruit_ST7735 tft = Adafruit_ST7735(cs, dc, mosi, sclk, rst);
// Set up the brain parser, pass it the hardware serial object you want to listen on.
Brain brain(Serial);
void setup(void) {
tft.initR(INITR_BLACKTAB); // initialize a ST7735S chip, black tab
// Start the hardware serial.
Serial.begin(9600);
// tft.setCursor(0, 30);
// tft.setTextColor(ST7735_RED);
tft.fillScreen(ST7735_BLACK);
tft.drawLine(0, 50, tft.width()-1, 50, ST7735_WHITE);
tft.setCursor(0, 60);
tft.setTextColor(ST7735_YELLOW);
tft.println("Body Temp : ");
tft.setTextColor(ST7735_RED);
tft.println("Heart Rate: ");
tft.setTextColor(ST7735_GREEN);
tft.println("GSR VAL : ");
tft.setTextColor(ST7735_YELLOW);
tft.println("EEG signal: ");
tft.setTextColor(ST7735_WHITE);
tft.println("Attention : ");
tft.setTextColor(ST7735_WHITE);
tft.println("Meditation: ");
tft.drawLine(0, 110, tft.width()-1, 110, ST7735_WHITE);
}
void loop() {
// tft.fillScreen(ST7735_BLACK); // clear screen
//delay(2000);
//tft.setTextColor(ST7735_GREEN, ST7735_BLACK);
//tft.println((float)DHT11.temperature,1);
//tft.setTextColor(ST7735_GREEN, ST7735_BLACK);
//tft.println((float)DHT11.humidity,1);
//tft.setTextColor(ST7735_GREEN, ST7735_BLACK);
// tft.println(DHT11.fahrenheit(), 1);
// tft.print(" ");
//tft.setTextColor(ST7735_GREEN, ST7735_BLACK);
// tft.println(DHT11.kelvin(), 1);
//tft.setTextColor(ST7735_GREEN, ST7735_BLACK);
//tft.println(DHT11.dewPoint(), 1);
//tft.setTextColor(ST7735_GREEN, ST7735_BLACK);
//tft.println(DHT11.dewPointFast(), 1);
// tft.setCursor(0,115);
// tft.print("Light intensity ");
//int val = analogRead(ANALOG_IN); // READ LIGHT SENSOR VALUE
//tft.setCursor(60, 130);
// tft.setTextColor(ST7735_YELLOW, ST7735_BLACK);
// tft.println(val, 1); // PRINT LIGHT SENSOR VALUE
//delay(2000);
tft.setCursor(0, 115);
tft.setTextSize(1);
tft.setTextColor(ST7735_YELLOW,ST7735_BLACK );
// Expect packets about once per second.
// The .readCSV() function returns a string (well, char*) listing the most recent brain data, in the following format:
// "signal strength, attention, meditation, delta, theta, low alpha, high alpha, low beta, high beta, low gamma, high gamma"
if (brain.update()) {
//tft.println(brain.readErrors());
tft.println(brain.readCSV());
}}
Good - did you notice i had attached the fixed file in #1?
No, I didn't realize .... But just tested it and guess what ..... IT WORKS !!!!!
YOU ARE THE BEST !!!! THANK YOU !!!
if you don't mind, can you tell me what did you change?
Did the find and replace for the stray character represented with the dot
You could also have copied back as suggested from your properly formatted code here in the forum. That cleans it too