Hello,
i am working on a rotary encoder and want to interface it with 7 segment display.
I want to display the value of angle in degrees I get on that segment display. I know how that 7 segment display works and I am also getting the angle in degrees in my serial monitor, but I don't know the logic which i should be using to make Arduino read that value from the serial monitor so that I can turn the corresponding LEDs on.
HarisIftikhar:
I am also getting the angle in degrees in my serial monitor, but I don't know the logic which i should be using to make Arduino read that value from the serial monitor so that I can turn the corresponding LEDs on.
I don't think you want to read the values from the serial monitor: the only way they got there was surely that you sent them there in the first place, via a Serial.print(someAngleOrOther) so you know them already.
So I would think you would just use someValueOrOther as the value to send to the seven segment display. I have had good success in the past witf the SevSeg library.
Why should the Arduino read the serial monitor? Isn't it the device that put it there?
Please post code and schematic. See How to use the forum.
Yes ,I am taking the values being printed on serial monitor from the encoder and they are changing continuously as my shaft rotates.
I need those constant values to be constantly incorporated with the LEDS as the code runs. I don't want them to change them myself by altering the code myself.
HarisIftikhar:
Yes ,I am taking the values being printed on serial monitor from the encoder and they are changing continuously as my shaft rotates.
I need those constant values to be constantly incorporated with the LEDS as the code runs.
I'm not sure what a "those constant values" means, but seems to me you should just continually send the value to the seven segment display, instead of to the serial monitor, using the library I linked to.
HarisIftikhar:
I don't want them to change them myself by altering the code myself.
I have no idea what that means: nobody's suggesting you set the values in the code, of course they are from the encoder.
HarisIftikhar:
I don't want them to change them myself by altering the code myself.
You have code that you do not understand? If so, post it here and we might be able to help.
Don't forget to use tags when posting code on the forum.