I'm doing a senior project that consist of hydrogen gas and water for school, and I need help with finding pressure and water level sensors for my project. Im using the Arduino 1280 Mega and a GLCD ks0108.
Im thinking about using a FSR sensor but Im not sure if this would work Hydrogen gas or water pressure, and I need some guidance on what sensors are best for this project.
Im also new to programming and just recently I tried to create my own code to display something on the LCD screen like just one word but I keep running into errors but I don't understand what the error messages are asking me to do. so I want to know is there a guide somewhere online that lets you know what error codes mean for the Arduino language?
so I want to know is there a guide somewhere online that lets you know what error codes mean for the Arduino language?
I am not aware of one. Basically the errors mean what they say. A thing to note though is that an error is raised not where the error actually is but at the point where the compiler gets confused.
So the big beginner mistake is to leave the semi colon off the end of a line. However, the compiler will only complain about things on the line after the missing semi colon.
It's the same sort of story with unmatched brackets, the real error could be there are too few '(' rather than too many ')'
I have just bought 2 FSR sensors for my project and Im trying to get the output results of the sensors to show on the GLCD kS0108 display I have. but Im not sure what the command line code to output the results to the GLCD KS0108 instead of the computer display monitor.
thanks for that link Grumpy, but Im still having problems with converting this program code for the FSR sensor to be outputted on to the GLCD screen:
/* FSR simple testing sketch.
Connect one end of FSR to power, the other end to Analog 0.
Then connect one end of a 10K resistor from Analog 0 to ground
For more information see www.ladyada.net/learn/sensors/fsr.html */
int fsrPin = 0; // the FSR and 10K pulldown are connected to a0
int fsrReading; // the analog reading from the FSR resistor divider
void setup(void) {
// We'll send debugging information via the Serial monitor
Serial.begin(9600);
}
void loop(void) {
fsrReading = analogRead(0);
Serial.print("Analog reading = ");
Serial.print(fsrReading); // the raw analog reading
// We'll have a few threshholds, qualitatively determined
if (fsrReading < 10) {
Serial.println(" - No pressure");
} else if (fsrReading < 200) {
Serial.println(" - Light touch");
} else if (fsrReading < 500) {
Serial.println(" - Light squeeze");
} else if (fsrReading < 800) {
Serial.println(" - Medium squeeze");
} else {
Serial.println(" - Big squeeze");
}
delay(1000);
}
But here is my entire code for my project that I modified but still cant get the FSR sensor to show up on the screen and the code compiles without any errors:
#include <ArduinoIcon.h>
#include <Arial14.h>
#include <ks0108.h>
#include <ks0108_Arduino.h>
#include <ks0108_Mega.h>
#include <ks0108_Panel.h>
#include <ks0108_Sanguino.h>
#include <SystemFont5x7.h>
int fsrPin = 0; // the FSR and 10K pulldown are connected to a0
int fsrReading; // the analog reading from the FSR resistor divider
void setup() {
// We'll send debugging information via the Serial monitor
GLCD.Init(9600);
GLCD.Init(NON_INVERTED);// initialise the library
GLCD.ClearScreen();//clears screen
GLCD.DrawBitmap(ArduinoIcon, 32, 0, BLACK); //draw the bitmap at the given x,y position
delay(1000);
GLCD.ClearScreen();//clears screen
GLCD.SelectFont(System5x7); // select fixed width system font
GLCD.ClearScreen();
GLCD.CursorTo(3,2);
GLCD.Puts("Hydrogen");
delay(3000);
GLCD.CursorTo(4,10);
GLCD.Puts("Powered");
delay(3000);
GLCD.CursorTo(3,6);
GLCD.Puts("Vehicle");
delay(3000);
GLCD.ClearScreen();
}
void loop(void) {
char fsrReading = analogRead(0);
GLCD.Puts("Analog reading = ");
GLCD.PrintNumber(fsrReading); // the raw analog reading
// We'll have a few threshholds, qualitatively determined
if (fsrReading < 10) {
GLCD.Puts(" - No pressure");
} else if (fsrReading < 200) {
GLCD.Puts(" - Light touch");
} else if (fsrReading < 500) {
GLCD.Puts(" - Light squeeze");
} else if (fsrReading < 800) {
GLCD.Puts(" - Medium squeeze");
} else {
GLCD.Puts(" - Big squeeze");
}
delay(1000);
}
ok Paul I changed the code and nothing shows up from the FSR sensor
#include <ArduinoIcon.h>
#include <Arial14.h>
#include <ks0108.h>
#include <ks0108_Arduino.h>
#include <ks0108_Mega.h>
#include <ks0108_Panel.h>
#include <ks0108_Sanguino.h>
#include <SystemFont5x7.h>
int fsrPin0; // the FSR and 10K pulldown are connected to a0
int fsrReading; // the analog reading from the FSR resistor divider
void setup() {
// We'll send debugging information via the Serial monitor
GLCD.Init(9600);
GLCD.Init(NON_INVERTED);// initialise the library
GLCD.ClearScreen();//clears screen
GLCD.DrawBitmap(ArduinoIcon, 32, 0, BLACK); //draw the bitmap at the given x,y position
delay(1000);
GLCD.ClearScreen();//clears screen
GLCD.SelectFont(System5x7); // select fixed width system font
GLCD.ClearScreen();
GLCD.CursorTo(3,2);
GLCD.Puts("Hydrogen");
delay(3000);
GLCD.CursorTo(4,10);
GLCD.Puts("Powered");
delay(3000);
GLCD.CursorTo(3,6);
GLCD.Puts("Vehicle");
delay(3000);
GLCD.ClearScreen();
}
void loop(void) {
fsrReading = analogRead(0);
GLCD.Puts("Analog reading = ");
(fsrReading); // the raw analog reading
// We'll have a few threshholds, qualitatively determined
if (fsrReading < 10) {
GLCD.Puts(" - No pressure");
} else if (fsrReading < 200) {
GLCD.Puts(" - Light touch");
} else if (fsrReading < 500) {
GLCD.Puts(" - Light squeeze");
} else if (fsrReading < 800) {
GLCD.Puts(" - Medium squeeze");
} else {
GLCD.Puts(" - Big squeeze");
}
delay(1000);
}