Jump to content

indirtwetrust

Members
  • Content Count

    7
  • Joined

  • Last visited

About indirtwetrust

  • Rank
    Noob Class

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. I hope this is the right place to ask this but I’m having a problem with unsigned long. According to the Energia reference it should go to 4,294,967,295. But my unsigned long value is overflowing at 65535 same as unsigned int. I’m using it as a set point for millies based on a pot so I’m limited to about 60 seconds. Anything over 65535 wraps back around to zero giving me a time of what it’s set to minus 60 seconds. I’m sure there’s a work around but everything I can find says unsigned long should work. please help, thanks.
  2. Well I think I got it ! I sure appreciate your help. A couple of things had me hung up though. I couldn't get the if statements to recognize the state of an actual assigned output like && (relayPinUP == LOW). I had to make variables I called stateUP / stateDN in addition to my "toggle" variable to keep track of which output's turn it is to fire. But then when I tried to "digitalWrite(stateDN, HIGH)" or LOW, the variable would not change state. I had to use the "!" to toggle it instead. Also, not having a good understanding of how the timer worked I was trying to use a timer1 & a timer0, 1 for on time, 0 for off time but I had to reset both in every if statement. It wasn't until it was all working that I realized I could just use 1 timer. what is the difference between using & or && and = or ==? it seems to work both ways. Let me know what you think, if I could make it better or anything. I'm going to add the LCD code to it again so I can see the values of the pots change in real time now. Thanks again Auto Call Program.txt
  3. This is the best I could do so far. I start with one output high, the first delay works and the output goes off, then the other output goes on (with a flicker) and locks up there, how can I start and stop the timers in the code in the IF statements? Also, i'll need to use some kind of variable to switch on and off, 1 or 0, true or false to keep the outputs alternating. I tried this but the format would not work if ((millis()-timer1)>sensorValue1) && toggle = 0){ ... Is there a decent cheat sheet for structure & formatting besides the single page one Have? I'll attach it too. Auto Call Program.txt energia_cheatsheetv01c.pdf
  4. Thanks I will try that. I have read that delay should be avoided but I also read that delay in Energia doesn't just hold up the processor. I'll start with reading the link.
  5. Thanks again for your help. I attached the Sketch I have so far. It works as is for my original project but after adding an LCD for experimentation, I would like to re-write it so that the sensorValues update continuously instead of waiting until the delays end. I haven't been able to figure out how to do it yet, I was looking at the multi-tasking examples but I get errors when trying to compile those sketches with multiple tabs. Then to go 1 step further, it would be cool if the delay could be affected by turning the pot after it got the "delay sensorValue" command. Auto Call Program.txt
  6. Ya, that was it! Thank you so much. I had no idea I had to set the output low before declaring it an output.
  7. I wrote a sketch to fire 2 outputs back and forth with a pot to adjust the on time of the outputs and a pot to adjust the off time. The outputs are just LEDs for now and there is a 3rd LED that turns on when either output is on (so I can adjust the pots later when the outputs are only driving silent, solid state relays.) Every time the MSP430G2553 is powered up or reset, in the Launchpad or a bread board, all of the pins configured as outputs go high for about a second before the program starts to run There is a thread that comes up with a google search of the problem where everyone just accepts that this is what the MSP430 does but it seems to be something that the underlying Energia code is doing because the C code does not make this happen. I altered the Blink source file in CCS to make the 2 onboard LEDs toggle back and forth. When the board is powered up running that code, both outputs don't go high. The LEDs just start to toggle back & forth as programmed. Has anyone else dealt with this? I really can't have all the outputs turn on at the same time with my project. Is there a way to write the Energia sketch to avoid this or do I have to learn how write my code in C? I hope you can excuse my ignorance. I just started trying to program a week ago. I took it up to make this one project when I decided it was going to be a little too complicated to build with discrete components. I really appreciate any help/advise.
×
×
  • Create New...