Good day everyone!
I was wondering on how do i use the swtich() case '#' function to allow an output thereafter. I have no idea why i cant seem to get it to work. Also note that i am using the ASCII table for value input.
The code would look something like this:
//
key=key-48
myValue= (myValue * 10 ) + key // that would give me 12 if i enter 1 then 2
if (key != NO_KEY)
{
switch(I dont know what goes in this parenthesis)
{
case '#' :
digitalWrite ( conveyor , HIGH ) ;
}
But i just cant seem to get '#' to do something. Am i doing something wrong? All help is greatly appreciated!
}
And also another question i have is that why cant i use lcd.clear()? Is it because my code goes like this?
lcd.setCursor(0, 0);
lcd.write("Select item");
lcd.display();
Anything i display after the first wouldnt go off after i use lcd.clear() .
Again all help is greatly appreciated !
Please use code tags (</> button on the toolbar) when you post code or warning/error messages. The reason is that the forum software can interpret parts of your code as markup, leading to confusion, wasted time, and a reduced chance for you to get help with your problem. This will also make it easier to read your code and to copy it to the IDE or editor. If your browser doesn't show the posting toolbar then you can just manually add the code tags: [code]``[color=blue]// your code is here[/color]``[/code]
Using code tags and other important information is explained in the How to use this forum post. Please read it.
Please always do a Tools > Auto Format on your code before posting it. This will make it easier for you to spot bugs and make it easier for us to read. If you're using the Arduino Web Editor you will not have access to this useful tool but it's still unacceptable to post poorly formatted code. I recommend you to use the standard IDE instead.
bob112112:
switch(I dont know what goes in this parenthesis)
Whatever variable you're testing the value of in your case statements. See:
bob112112:
And also another question i have is that why cant i use lcd.clear()?
Impossible to say from the information you've provided. Post your full sketch.
pert:
Please use code tags (</> button on the toolbar) when you post code or warning/error messages. The reason is that the forum software can interpret parts of your code as markup, leading to confusion, wasted time, and a reduced chance for you to get help with your problem. This will also make it easier to read your code and to copy it to the IDE or editor. If your browser doesn't show the posting toolbar then you can just manually add the code tags: [code]``[color=blue]// your code is here[/color]``[/code]
Using code tags and other important information is explained in the How to use this forum post. Please read it.
Please always do a Tools > Auto Format on your code before posting it. This will make it easier for you to spot bugs and make it easier for us to read. If you're using the Arduino Web Editor you will not have access to this useful tool but it's still unacceptable to post poorly formatted code. I recommend you to use the standard IDE instead.
Whatever variable you're testing the value of in your case statements. See: switch...case - Arduino Reference
Impossible to say from the information you've provided. Post your full sketch.
oh thank you i have been wondering on how to do it. Anyways i will reupload the questions !
if (key != NO_KEY)
{
if (key >= '0' && key <= '9')
myValue = (myValue * 10 ) + (key - '0'); // that would give me 12 if i enter 1 then 2
switch (key)
{
case '#' :
digitalWrite ( conveyor , HIGH ) ;
}