kungfufishstick

Members
  • Content Count

    32
  • Joined

  • Last visited

Community Reputation

3 Neutral

About kungfufishstick

  • Rank
    Rocketeer

Recent Profile Visitors

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

  1. I know you helped me when I first got into trying to code my own controller. That was the most knowledge I had as well. What I learned from writing html raw into notepad and then saving as html
  2. There is a learning curve, just like with any programming language. It helps to have some prior knowledge of a programming language since that helps understand syntax and things of that nature. Everyone here helps a lot and it really just comes down to continual practice with the coding and putting the components together properly to get the action you are looking for. I have some blue LED rocker switches that I spent a couple of days working on to get them to function properly. I wanted the LED to light up when the rocker was activated but for the longest time it would stay on at all times. There have been a lot of design aspects that I knew what I wanted but it took a lot of trial and error to get it running smoothly. It also helps a lot to ask questions around here if you get stumped. I know I had someone help me a ton writing the code to get the safety switch and launch button to work.
  3. Oh lucky! I am pretty much solo on this. I think I will just type out the letters I need on my phone and then trace them with the transparent sheets and cut it away with an xacto knife.
  4. I had thought about that but the ink in my printer is all dried out from lack of use and it will cost a lot to replace the ink. I swear, you could run a printer on liquid money for less than buying ink.
  5. I remember looking at your project. I do have the code set up for how I want it to work so the hard part is getting everything put together. I will need to go through and probably tweak the code since I havent messed around with it since before ksp moved past 1.0. I already have all the parts for it too and I had previously cut all the wiring needed to put it together. It was seriously the bulk of the cost of making a controller. The hard part of this approach is getting the sticks to stay put and waiting for the glue to dry. I may go get some gorilla wood glue since I imagine itll have a shorter dry time and be stronger. I can use the sticks for the paneling and probably get some square wood rods that can acommidate screws to get a frame put together quickly. I just definitely needed to get the annuciator panel out of the temporary cardboard set up i had it all sitting in for so long. The only other things that needs put together are the housings for the joysticks and the mini project that is going to be the throttle lever.
  6. I just thought I would share what I am working on. I normally hate posting a WIP because I tend to get super enthusiastic about a project and then never get around to actually finishing it. I felt that I had to share this though. I see so many awesome controllers for this game and I always wanted done of my own. I originally was working on a my own controller using a type of wood that was left over from when it was being used to make a child sized rocking chair. The wood turned out too thick to mount any switches or buttons to it. Everyone on here seems to have made, or at least started, their own controller and it always appeared to involve ordering custom printed circuit boards, CNC machining, 3D printing, and so on. I just don't have the access, or the financial means, to make that a reality, so I have had to go low budget. After finally getting fed up with all of my components collecting dust, I decided to take a trip to the local Walmart. After a walk through of the store, I ended up buying craft popsicle sticks and wood glue. It is actually turning out nice. The wood is pretty strong after you glue a brace to a row of sticks and let the glue dry completely. I also have access to a power drill and a Dremel drill that I managed to get my hands on when I attempted to make my own controller the first time. In the pictures I have the LED lights that are going to be the annunciator lights on the panel. They are very bright and clear LEDs so you can't tell what color they are, so I had to label each of them at the LED. This works out fine since you won't be able to see the writing after the entire enclosure is finished. I still haven't figured out what to do for the face of the panel. I used to work on military aircraft and I really liked the black plastic covers that had the lettering for the annunciation cut away so that the light shows through the lettering. Since I think that takes some kind of laser cutting and that just isn't going to happen, I will have to figure something else out. Maybe marking out some transparent sheets meant for stencils and then cutting away with an Xacto knife. I am seriously thinking of just making the entire thing out of popsicle sticks. It turns out to be strong enough to work with after the glue dries, and it just makes me think it is something that would be found at the Kerbal Command Center in the early days of a career play through. On a last note, I wanted to post this because I want to show that a controller is possible on a budget. The housing for the controller doesn't need to be super expensive to turn out decent. Put that extra money into the lights, buttons, switches, potentiometers, Arduino boards, etc. The code that makes it all work is the brilliance that is KSP Serial IO by zitronen. On a side note, holes were drilled in the sticks so the LED can poke through. Underneath that is a hole that the wiring is fed through. It is all coiled up just to make it easier to store it all. I have the wiring cut in order to accommodate connecting it to the Arduino board for testing. I didn't want to make it a permanent arrangement, just in case, so the LEDs are sandwiched together by two lengths of twist tie. As for the lighting: All the Custom Groups (CG) are blue SAS/RCS/Light is green Gear/Brake is red Fuel/Mono/Elec Cau (cautions) are yellow the two open are just blank spots on the panel Fuel/Mono/Elec Warn and Overheat/Stage Lock are all red. The layout was originally different so that is why Gear and Brake are in with SAS, RCS, and Light. I am currently working on gluing sticks together to give the lights individual compartments to avoid lighting up the wrong indication on the panel. I am gluing the entire length of the sticks to fill any gaps and I plan to cover or paint over that so it completely blocks all light that could come from other LEDs.
  7. I was curious if anyone had a fix for an issue I'm having. I like to place radial chutes in a storage bay to prevent them from burning up on re-entry. On the console they go red as soon as I launch and they have to be manually deployed on decent after I open the storage bay.
  8. I have a quick question, where can you set your controls to toggle in KSP? I am using momentary switches for the action groups.
  9. Its alright. I tried my hardest to get it working. I will put the code up somewhere tomorrow after I swap out the jumpers for register 2 with ones that I didn't make myself to rule that possibility out. Ill also just send you a message, rather than plastering big posts all over zitronen's post for this plug-in. When this whole mess gets sorted out, I will just put up a link to how it was sorted out. I feel kind of bad about the wall of text from that last post.
  10. I'm right back into not quite understanding what is going on. I gave unsigned long for warnings a shot (I keep trying to figure out array but it is just flying right over my head). I set up warningSet a couple of different ways. byte warningSet(byte warnings, byte n, boolean s) { if (s) { digitalWrite(LATCHPIN, LOW); warnings |= (1 << n); // forces nth bit to 1 shiftOut(DATAPIN, CLOCKPIN, MSBFIRST, warnings); shiftOut(DATAPIN, CLOCKPIN, MSBFIRST, warnings>>8); shiftOut(DATAPIN, CLOCKPIN, MSBFIRST, warnings>>16); digitalWrite(LATCHPIN, HIGH); } else { digitalWrite(LATCHPIN, LOW); warnings &= ~(1 << n); // forces nth bit to 0 shiftOut(DATAPIN, CLOCKPIN, MSBFIRST, warnings); shiftOut(DATAPIN, CLOCKPIN, MSBFIRST, warnings>>8); shiftOut(DATAPIN, CLOCKPIN, MSBFIRST, warnings>>16); digitalWrite(LATCHPIN, HIGH); } return warnings; } I also tried switching the order of the shift out so that it went warnings, warnings>>8, warnings>>16 with no change. I did read over what you said, but I am not sure where the shiftout would go within void indicators. I am going to go ahead and hope that I don't have to put a shiftOut function within every if statement. So how would it be able to interact with the warnings within the if statements if it is not within each if statement or within warningSet? Would the shiftOut go after all of my if, else statements? This is the only thing I can think of. Since void indicators() will run down each if else statement in turn, and then it can spit out the results when it reaches the shiftout section. I have my if statements set up in a pattern like this: if (fuelcaution != 0 && fuelwarning == 0) warnings = warningSet(warnings, 0, true); else warnings = warningSet(warnings, 0, false); if (fuelwarning != 0) warnings = warningSet(warnings, 1, true); else warnings = warningSet(warnings, 1, false); I don't think I can put the shiftOut before the if, else statements, and it doesn't make sense to me that it would go after all of them. Each if, else calls on warningSet and it does its thing......unless I just had a light bulb and the result of warningSet running its course for every if, else statement is being held for the duration of void indicators until a shiftOut is reached (before the void cycles through again). I will give an array a try. I want to make absolutely sure that I can't figure it out myself before I take the time to add a bunch of 2s and 3s to set it up so that I have warnings2 and warnings3 to go with new warningSet2 and warningSet3. I will do a bunch of trial and error for an array (most likely error unless I get very lucky stumbling through it). EDIT: Alright, I put digitalWrite(LATCHPIN, LOW); shiftOut(DATAPIN, CLOCKPIN, MSBFIRST, warnings>>16); shiftOut(DATAPIN, CLOCKPIN, MSBFIRST, warnings>>8); shiftOut(DATAPIN, CLOCKPIN, MSBFIRST, warnings); digitalWrite(LATCHPIN, HIGH); At the end of void indicators(), initLEDS(), and LEDSAllOff(). The good news is that there is no more dim flickering across all the LEDs. The bad news is that only LED 7 for gear works properly. EDIT 2: One last update. I did everything I could think of and even tried to adapt things I found in google searches. Nothing got it to function properly when the registers were chained together. I threw my hands up in frustration and decided that was a terrible choice as well. I have the shift registers defined separately and and hooked up properly (I think). Something is going wrong. Only the first register is functioning properly. The other two have arbitrary LEDs lighting up and they aren't changing to reflect a state change. After getting the shift registers hooked up on their own pins, this is all that I did: added byte declarations for warnings2 = 0, warnings3 = 0; split the 23 LEDs into 3 groups of 8, 8, and 7 bits wrote up 2 additional byte warningSet and named them warningSet2 and warningSet3 Everything is coded the same for warnings2 and warnings3 (same for warningSet2/warningSet3) but changed to work with the right group (warnings2, latchpin2, clockpin2, datapin2). My only guess to the issue is that I used a number in the name for the different declarations, since warnings and warningSet do not have a number in their name. I'm tired after fighting with this code all night. It's bed time. Hopefully someone has an answer, and hopefully not something that I am going to smack myself when I get it for being too stupid to realize it.
  11. Alright, I just want to make sure I have this correct for my shift registers. I finally got around to making enough jumpers to accommodate all of the LEDs I plan on using and have all 3 shift registers daisy chained together. There are a couple of things I'm not sure about. Do I need a shiftOut line for each shift register? Does the numbering for pins increase as you go up or is there a special numbering after you go through 0-7 pins? After I got everything hooked up, the lighting has gone crazy. I have 23 LEDs for various indications and there are only 4 that are lighting up when you load into launch from the VAB. EDIT: When the code was working fine with just a single shift register, this was the code. byte warningSet(byte warnings, byte n, boolean s) { if (s) { digitalWrite(LATCHPIN, LOW); warnings |= (1 << n); // forces nth bit to 1 shiftOut(DATAPIN, CLOCKPIN, MSBFIRST, warnings); digitalWrite(LATCHPIN, HIGH); } else { digitalWrite(LATCHPIN, LOW); warnings &= ~(1 << n); // forces nth bit to 0 shiftOut(DATAPIN, CLOCKPIN, MSBFIRST, warnings); digitalWrite(LATCHPIN, HIGH); } return warnings; } I changed it to this to try and get the LEDs to light up properly. byte warningSet(byte warnings, byte n, boolean s) { if (s) { warnings |= (1 << n); // forces nth bit to 1 digitalWrite(LATCHPIN, LOW); shiftOut(DATAPIN, CLOCKPIN, MSBFIRST, warnings); shiftOut(DATAPIN, CLOCKPIN, MSBFIRST, warnings>>8); shiftOut(DATAPIN, CLOCKPIN, MSBFIRST, warnings>>16); digitalWrite(LATCHPIN, HIGH); } else { warnings &= ~(1 << n); // forces nth bit to 0 digitalWrite(LATCHPIN, LOW); shiftOut(DATAPIN, CLOCKPIN, MSBFIRST, warnings); shiftOut(DATAPIN, CLOCKPIN, MSBFIRST, warnings>>8); shiftOut(DATAPIN, CLOCKPIN, MSBFIRST, warnings>>16); digitalWrite(LATCHPIN, HIGH); } return warnings; } For numbering, it looks something like this for turning the LED on for a given condition. (simply taken from void initLEDS() but it is the same in each if statement for warnings and cautions) warnings = warningSet(warnings, 0, true); warnings = warningSet(warnings, 1, true); warnings = warningSet(warnings, 2, true); warnings = warningSet(warnings, 3, true); warnings = warningSet(warnings, 4, true); warnings = warningSet(warnings, 5, true); warnings = warningSet(warnings, 6, true); warnings = warningSet(warnings, 7, true); warnings = warningSet(warnings, 8, true); warnings = warningSet(warnings, 9, true); warnings = warningSet(warnings, 10, true);
  12. I just went ahead and added the shift out code within the byte warningSet. For the first version of my controller, I don't plan on using shift registers for anything other than LED indications. Thank you so much for the help. I really appreciate it.
  13. And to any future readers that are new, don't forget to declare byte warnings = 0; Alright, no errors on compile. I am not getting the LED to come on. Would it be possible that I need to include shift out code? EDIT: Adding the shift code was necessary. I have the LED working. Now on the the rest. A quick question: If I daisy chain additional shift registers, would the numbering for the pin just continue up with each LED?
  14. Alright, I added the code to the right tabs and have everything set up how I figure it should be set up. I decided to copy the code you showed in the example to get it working before I have a go at changing it. After some several compile/builds I managed to get the errors down to a couple, but I am unsure how to correct them. Here is what I have added: Utilities.ino if (fuelcaution != 0) warnings = warningSet(warnings, 0, true); void warningSet(byte warnings, byte n, boolean s) { if (s) { warnings |= (1 << n); // forces nth bit to 1 } else { warnings &= ~(1 << n); // forces nth bit to 0 } return warnings; } The errors I am getting are: /utilities.ino: In function 'void Indicators()': /utilities.ino: error: void value not ignored as it ought to be warnings = warningSet(warnings, 0, true); /utilites.ino: In function 'void warningSet(byte, byte, boolean)' /utilities.ino: error: return-statement with a value, in function returning 'void' [-fpermissive] return warnings; [stino - Edit with error code 1.]
  15. Alright, so to set it all up to call a function for each indication I would need to just set it up how you explained for each indication that is needed. Would I handle when they are called like how it is done with the caution and warning that comes in the code by default using the if( caution != 0) statements but replacing caution with one of my choosing?