I am trying to display something that I have on my serial monitor to the screen of the microview, but I am not sure how to code this. Do any of you know how to code this?
This is the data I am trying to display on the screen of the microview: http://www.electroschematics.com/12145/working-with-water-flow-sensors-arduino/
Did you already run the examples for the microview?
I ran the examples on the microview, I get data from the sensor on the serial monitor of the arduino IDE, but I want this data on the microview screen.
Have you properly installed the Microview library? It can be found here microview getting-started.html. There are examples with the Microview library that use the display.
Yes, the microview library doesn't have a code that helps me translate the data that I get from this code to the screen:
*/
volatile int flow_frequency; // Measures flow sensor pulses
unsigned int l_hour; // Calculated litres/hour
unsigned char flowsensor = 2; // Sensor Input
unsigned long currentTime;
unsigned long cloopTime;
void flow () // Interrupt function
{
flow_frequency++;
}
void setup()
{
pinMode(flowsensor, INPUT);
digitalWrite(flowsensor, HIGH); // Optional Internal Pull-Up
Serial.begin(9600);
attachInterrupt(0, flow, RISING); // Setup Interrupt
sei(); // Enable interrupts
currentTime = millis();
cloopTime = currentTime;
}
void loop ()
{
currentTime = millis();
// Every second, calculate and print litres/hour
if(currentTime >= (cloopTime + 1000))
{
cloopTime = currentTime; // Updates cloopTime
// Pulse frequency (Hz) = 7.5Q, Q is flow rate in L/min.
l_hour = (flow_frequency * 60 / 7.5); // (Pulse frequency x 60 min) / 7.5Q = flowrate in L/hour
flow_frequency = 0; // Reset Counter
Serial.print(l_hour, DEC); // Print litres/hour
Serial.println(" L/hour");
}
}
Please enclose code in code tags </>.
Your example is not related at all to the microview display. Please look for an example that writes something to the microview display.
mabrao17:
Yes, the microview library doesn't have a code that helps me translate the data that I get from this code to the screen:
<...>
Before someone complains big time about you posting code in the forum.... you are suppose to use the "</>" symbol in the upper left of the tool bar to open the code-posting format symbols - post/paste your code between the symbols.
Now that the housekeeping is out of the way... let's discuss the microview... it is an OLED graphic display.... little dots make up characters just like the LCD screen of your notebook. The Arduino serial monitor is a character-based console. This is an OIL & WATER situation.
Graphic libraries that come with the microview can take a character and map it to a grouping of dots on the microview. So, to put text (character-based letters) on the microview, you must provide a minimum of the location where the character is to be displayed, the size of the character, and the code of the character.
In this example, you can see the below section of code that puts characters on the screen:
void displayRemove(char * text) {
int y=0;
uView.clear(PAGE);
uView.setCursor(0,y);
uView.print("Well done!");
uView.setCursor(0,y+9);
uView.print("Remove the");
uView.setCursor(0,y+18);
uView.print(text);
uView.setCursor(0,y+27);
uView.print("to proceed");
uView.display();
}
To put the results from the IDE console on the microview, you need to create a bit of code that acts as a serial monitor, that is, code that takes character-by-character and places it on the screen then moves to the next line, and repeats.
Here is someone that has already written a terminal program for the microview ... you should be able to adapt their code to your existing code (combine the two) and get what you want:
https://jammingsignal.com/2015/01/04/microview-demos/
That's what I need, I need a code for this sensor that I could use with the microview...
I looked over all the sparkfun page and the microview website and couldn't find any tutorial related.
mabrao17:
That's what I need, I need a code for this sensor that I could use with the microview...
I looked over all the sparkfun page and the microview website and couldn't find any tutorial related.
The code is in the example that is on the github page for the libraries that support the microview ... unfortunately, you have to #include the libraries and you have to insert the display code ... just like the example.
https://jammingsignal.com/2015/01/04/microview-demos/
The github page is: MicroView/Arduino/Terminal/Terminal.ino at master · LeifBloomquist/MicroView · GitHub
This arduino stuff is 90% Googling ...
Ray