Page 1 of 1
HELP!!! I need help coding a coffee machine
Posted: Mon Jan 08, 2024 12:49 pm
by TreeSpirit101
It needs to simulate temp change and have 2 buttons to select 2 different sizes.

Re: HELP!!! I need help coding a coffee machine
Posted: Mon Jan 08, 2024 1:35 pm
by chipfryer27
Hi
If you attach what you have so far, then perhaps someone can assist?
Regards
Re: HELP!!! I need help coding a coffee machine
Posted: Tue Jan 09, 2024 9:37 am
by TreeSpirit101
Apologies I forgot to upload my code.
Re: HELP!!! I need help coding a coffee machine
Posted: Tue Jan 09, 2024 10:27 am
by chipfryer27
Hi
First thing is that you have not set up your clock correctly. In the settings you have it set for internal oscillator running at 32MHz, but for this to work in hardware you will need to use a C-code block as your first icon. If you add in the IntOsc Helper component this will help you further in setting the correct code. It won't affect simulation.
In your size select Macro I assume you wish to choose either "normal" or Espresso, and "normal" or Maxi? However if you select Espresso you also set "select" to "1" which will almost immediately exit your loop (32MHz runs fast) as the loop is set to exit if Select is >=1. Unless you have the reflexes of Superman you won't get a chance to then select Maxi

You can check this by going to Debug and Stepping through your program. If you do this the Simulation Debugger window will appear where you can select variables to monitor. You can also change their values too. This will help you figure out what you need to do in that Macro to be able to select all options.
Not sure why you are converting Int2Float in your Heater Macro. You are sampling the ADC as an integer so all that will do is add in a ".0"
Regards