I am taking the plunge into Arduinos and I am working on programing for an Ethanol analyzer and fuel pressure system. I have taken 2 sketches that I found from different sources and tried combining them for this task. Can someone please take a look at this coding and advise if this should work? I am still working on the wiring and Bluetooth app for this device, so at the moment I don't have a way to inspect. Any help would be appreciated.
I want to to use a non-digital analogon to explain:
imagine you want to do free-style BMX-biking:
Your momentary knowledge about riding a BMX-bike in an artistic way is:
I can ride a bike on a street, I am a little shaky while riding but basically it works.
I can visually distinguish between a street-racebike, a mountain-bike and a downhill-bike and a BMX-bike.
Your momentary approach is:
"can you please show me how you are doing back-flips in the half-pipe?
I will watch you driving and then I try on my own"
Well this won't work. You don't start artistic back-flips in the half-pipe if you are still a little shaky on bike-riding.
You start with much smaller and easier exercises.
Your own brain has to learn how to move your body for things like jumps.
It is very different to do jumps coming from the low-side jumping up in the air
or coming from the up-side jumping down a halfpipe.
Well this analogon does not work out in all details.
In programming you can't break your bones - of course
You don't need to do training on the braincells responsible for balancing
If a bug occurs you need knowledge about how programming works and what could cause this bug.
As you are working with electronic parts you need at least a basic knowledge about electronics because the parts are not superstandardised like ready to use USB- or blue-tooth-devices.
pre-programmed text that lists up what you have to do:
You are welcome on this forum! You are working on an informatic project and what is most needed in an informatic project is information imagine: do the other users here in the forum have a clear picture of what you are trying to do?
To speed up finishing your project you should invest some time into writing additional information I'm 100% sure that this WILL speed up finishing your project.
So please go through this checklist and if you find an item you haven't posted yet post it
did you write which exact type of microcontroller you are using?
description of your programming skills and knowledge
description of your knowledge about electronics
description of the functionality you want to have written in normal works avoiding programming terms
do you have an oscilloscope? Yes / No
do you have a digital multimeter (DMM) Yes / No)
did you post your complete sketch?
if relevant did you post a link to a datasheet of each component you are using?
if relevant did you post a handdrawn schematic or your wiring?
if you got a compiler-error. Did you post the complete compiler-output into a code-section?
If you don't post all this information because you want a "quick answer" to your detail problem It is very likely to turn out that all that happens is having mutliple waiting-times with mutliple asking back for details until the other users do have a clear picture of what you want to do.
Can you please post your code in your post please.
To add code please click this link;
/*Code Start */
/* This example demonstrates how to take a standard 3-wire pressure transducer
* and read the analog signal, then convert the signal to a readable output and
* display it onto an LCD screen.
* Contact Tyler at email@example.com if you have any questions
#include "Wire.h" //allows communication over i2c devices
#include "LiquidCrystal_I2C.h" //allows interfacing with LCD screens
const int pressureInput = A0; //select the analog input pin for the pressure transducer
const int pressureZero = 102.4; //analog reading of pressure transducer at 0psi
const int pressureMax = 921.6; //analog reading of pressure transducer at 100psi
const int pressuretransducermaxPSI = 100; //psi value of transducer being used
const int baudRate = 9600; //constant integer to set the baud rate for serial monitor
const int sensorreadDelay = 250; //constant integer to set the sensor read delay in milliseconds
float pressureValue = 0; //variable to store the value coming from the pressure transducer
LiquidCrystal_I2C lcd(0x3f, 20, 4); //sets the LCD I2C communication address; format(address, columns, rows)
void setup() //setup routine, runs once when system turned on or reset
Serial.begin(baudRate); //initializes serial communication at set baud rate bits per second
lcd.begin(); //initializes the LCD screen
void loop() //loop routine runs over and over again forever
pressureValue = analogRead(pressureInput); //reads value from input pin and assigns to variable
pressureValue = ((pressureValue-pressureZero)*pressuretransducermaxPSI)/(pressureMax-pressureZero); //conversion equation to convert analog reading to psi
Serial.print(pressureValue, 1); //prints value from previous line to serial
Serial.println("psi"); //prints label to serial
lcd.setCursor(0,0); //sets cursor to column 0, row 0
lcd.print("Pressure:"); //prints label
lcd.print(pressureValue, 1); //prints pressure value to lcd screen, 1 digit on float
lcd.print("psi"); //prints label after value
lcd.print(" "); //to clear the display after large values or negatives
delay(sensorreadDelay); //delay in milliseconds between read values
*/ Code End