zitronen

Members
  • Content Count

    664
  • Joined

  • Last visited

Community Reputation

222 Excellent

About zitronen

  • Rank
    Sr. Spacecraft Engineer

Recent Profile Visitors

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

  1. Well done! When you guys get stuff working, it makes me happy. I would suggest adding time to AP, it's really useful to have to know if you are going to slow or to fast to orbit efficiently. More or less. The way it's written the command goes on when pin is connected to Vcc (3.3 or 5V) not ground, but it's the same principle. Also this is set up for a switch, not a button, unless the button is latching. In order to turn on RCS, a specific bit in the controls byte of the data packet needs to be set. The maincontrols() function just makes the code easier for people to read. Rather than having to remember which bit number is RCS, and doing the bit maths do set it, you just do maincontrols(RCS, HIGH).
  2. Haha nice. This is also why I'm not sharing the code I use for my personal display, it's a huge mess! No you put the folder in GameData, like all other mods, not in PluginData. You can also use CKAN to install it automatically, since it was updated recently. Also yes you can change the default port in the config file. If the plugin can't find the default port it will check other available ports on your PC.
  3. That means it's connected. If you plug in some LEDs as described in the first post, do they work? If your inputs don't work, it's because there are problems for things like switches and axis controls in Windows 10, which are related to serial port drivers. Some arduino boards work some don't, some people report cheap ones from China have better chance of working. You can try searching this thread for previous attempts. Uh.. floats have a variable number of decimal points, that's why they are called "floating" point. Mach number is a sent as a float. Arduinos only support 32bit floats, they have about 7 significant digits (M=1.235678, M=12.345678 M=123.45678, etc.), times are always in seconds, but some are signed (int) because they can be negative and some are unsigned (UInt). The only time related variable that is a float is "deltaTime" which is the time interval in seconds since last serial packet was sent from KSP, used for calculating derivatives.
  4. If you are new, I would suggest starting with something simple, follow the instructions on the first post. Start with a button and LED. If you are using code from someone else and you have a problem, I can't really help you. Also please post the debug log https://wiki.kerbalspaceprogram.com/wiki/Debug_Toolbar
  5. You can try the latest version plugin 0.19.1 and arduino demo 17 (I updated links in first post). They should be compatible with KSP 1.7-1.3. Please post the KSP debug log, and tell us which version of the plugin and arduino code you are using.
  6. There are 2 main loops, a input and output with separate tabs. Input() has a if statement that checks if a packet is received from KSP, so put you LEDs, displays stuff in here so they only executes when you receive something new. Output() function has a if statement that checks against a timer, put your switches, axis and other controls in the controls() function this is triggered every 25ms. Avoid running stuff constantly in the background so the code has enough time to process the serial data when not doing your stuff. Remember the arduino is single threaded, it can only do one thing at a time.
  7. I think it's a bit too early to say what we can do at this stage, but this is definitely something that interest me. I still remember when I first landed on the Mun , this was like KSP 0.07, without landing legs, manoeuvre nodes or even quick save! I paid $10 for KSP, got all expansions for free. Pretty good deal! I do wish Squad and the original crew was making KSP 2, but definitely exciting times.
  8. I wouldn't worry about if statements. If statements themselves take almost no time (maybe 1 or 2 CPU cycles at 62.5ns per cycle), the digitalRead/digitalWrite functions are the slow bit, they take a few micro seconds. By default the IO pins are only checked every 25ms, when a control packet is sent to KSP, not all the time. 25ms is enough to check many 1000s of IOs with if statements. Of course you can use interrupts, but it won't make much difference in speed. Printing to LCDs, floating point math, sending and receiving serial data take far more time.
  9. No reason, just lazy and forgot! I think it's working fine with the latest KSP, I use it myself. Hmm.. The joystick code has not been updated since KSP added SAS modes, might look into changing it in the future, it is kind of outdated. I suggest for now you can use a arduino leo or similar in USB joystick mode (google arduino usb joystick if you've not done it before), and just map your axis in KSP like a normal joystick. Frankly you will have a better experience since USB HID joysticks can have much faster refresh rates than my plugin, and you won't have any SAS problems.
  10. Hmm this is weird. Why would you want to know this value? If you just want to know how deep you are in the atmosphere why not just use altitude and remember atmo start height for each planet? That formula is also odd since IRL density ratio is exponential, not 4th root. Density by itself is useful, if density halves your drag and lift halves at the same true air speed, which is why I included it.
  11. Is it not just air density? Where sea level is 100% (1.225kg/m^3) and space is 0%?
  12. Hi I'm not so sure taking out the if statement is a good idea, will reply to you on github.
  13. I just checked, with KSP IO version 0.19.1, arduino Demo 17, everything is working in KSP 1.7.1 with all the expansions (making history, breaking ground). Are you sure you have the right version of the plugin? Can you post the debug log?