Display Numbers as Words?

Hey all, For a project I'm working on, I need to be able to display the channel number of a digital potentiometer as a word on my LCD screen. For example, when my sketch cycles through channel 1 of the digital pot, I have programmed it to show "Channel 1" on my display. Instead of "Channel 1", I want it to say "Potatoes", or any other word. I'm currently using the lcd.print(channel) function to display the channel number of the digital pot (of course after setting its position, and putting "Channel" before it in the loop. How can I have the number of the digital pot channel correspond to a word, and then print that word on the display?

Cheers! Eren Semonik

You have not posted your code, but it sounds like you could do it with a SwitchCase Statement


char *ChannelNames[] = {"Potatoes", "Carrots", "Peas", "Mustard"};

for (int i=0; i< sizeof ChannelNames / sizeof ChannelNames[0]; i++) {
    // Display the names for channels 0, 1, 2, and 3

Thanks for your help guys! Both replies were very helpful. Just what I needed!

Cheers! Eren Semonik