Jump to content

Freakout242

Members
  • Posts

    25
  • Joined

  • Last visited

Everything posted by Freakout242

  1. Not sure that you mean by "reset". Sorry. I am making an Android APP that will act as a "Glass Cockpit". At least thats the idea. I'll post more pics once I am done testing.
  2. I would like to thank everyone here for helping me out with getting this Serial communication down. I now have it working and displaying data from KSP to my phone. I am making a prototype Android App that should show me all the data I need for a mission. Link to the screenshot is below. Again thanks everyone. KSP_ISO Glass Cockpit Project
  3. I did, but it still didn't work....HOWEVER!!!! I also placed Serial1.println((long)VData.ECharge); Right below the loop statement...and it's WORKING!! WOO HOO!
  4. OK Guys....I'm Stuck. Got myself a Mega board (love it) and I wrote the following sketch. void setup() { // initialize both serial ports: Serial.begin(9600); Serial1.begin(9600); } void loop() { Serial.print("Test1 "); Serial1.println("Test2 "); delay(1000); } I was able to receive data from both the Serial Monitor and my phone (which is connected to my bluetooth adapter....which is monitoring Serial1). So YAY! The I placed this code for ksp into the "utilities" tab in order to get the Electric Charge total. Serial1.begin(38400); Serial1.println((long)VData.ECharge); I get no response. Any ideas? I have also tried Serial1.println(VData.ECharge); as well. EDIT: I added my lcd display with the above code. I can see data on the LCD screen, but still nothing over the Serial1 monitor.
  5. I think I'm going to just get a mega. How would you do it without softwareSerial?
  6. I changed it to 10 and 11 while troubleshooting. So that's not it. I wrote a simple sketch and used Serial.print("hello"); and portOne.println("goodbye"); and it works. Data will show over my com port and through the bluetooth. But when I place it on the sketch for ksp, I get nothing.
  7. Ok, this has been a long day of troubleshooting with just a few wins. Long story short, I am trying to connect my Arduino Bluetooth adapter to my phone and have it display some data from KSP. I know that I can't connect directly to pin 0 and 1 for this, so I included the <SoftwareSerial.h> Library. I defined pins 12 as Rx and 11 as Tx, then called it mySerial . I set mySerial.begin to 38400. I was able to connect to the adapter with a bluetooth terminal app, but I am receiving no data from mySerial.print(VData.AP); Thoughts? //pins for LEDs #include <LiquidCrystal.h> #include<SoftwareSerial.h> SoftwareSerial portOne(10, 11); LiquidCrystal lcd(7, 6, 5, 4, 3, 2); int contr = 9; int bright = 100; //Action group statuses #define AGSAS 0 #define AGRCS 1 #define AGLight 2 #define AGGear 3 #define AGBrakes 4 #define AGAbort 5 #define AGCustom01 6 #define AGCustom02 7 #define AGCustom03 8 #define AGCustom04 9 #define AGCustom05 10 #define AGCustom06 11 #define AGCustom07 12 #define AGCustom08 13 #define AGCustom09 14 #define AGCustom10 15 //macro #define details(name) (uint8_t*)&name,sizeof(name) //if no message received from KSP for more than 2s, go idle #define IDLETIMER 2000 #define CONTROLREFRESH 25 unsigned long deadtime, deadtimeOld, controlTime, controlTimeOld; unsigned long now; boolean Connected = false; byte caution = 0, warning = 0, id; struct VesselData { byte id; //1 float AP; //2 float PE; //3 float SemiMajorAxis; //4 float SemiMinorAxis; //5 float VVI; //6 float e; //7 float inc; //8 float G; //9 long TAp; //10 long TPe; //11 float TrueAnomaly; //12 float Density; //13 long period; //14 float RAlt; //15 float Alt; //16 float Vsurf; //17 float Lat; //18 float Lon; //19 float LiquidFuelTot; //20 float LiquidFuel; //21 float OxidizerTot; //22 float Oxidizer; //23 float EChargeTot; //24 float ECharge; //25 float MonoPropTot; //26 float MonoProp; //27 float IntakeAirTot; //28 float IntakeAir; //29 float SolidFuelTot; //30 float SolidFuel; //31 float XenonGasTot; //32 float XenonGas; //33 float LiquidFuelTotS; //34 float LiquidFuelS; //35 float OxidizerTotS; //36 float OxidizerS; //37 uint32_t MissionTime; //38 float deltaTime; //39 float VOrbit; //40 uint32_t MNTime; //41 float MNDeltaV; //42 float Pitch; //43 float Roll; //44 float Heading; //45 uint16_t ActionGroups; //46 status bit order:SAS, RCS, Light, Gear, Brakes, Abort, Custom01 - 10 byte SOINumber; //47 SOI Number (decimal format: sun-planet-moon e.g. 130 = kerbin, 131 = mun) byte MaxOverHeat; //48 Max part overheat (% percent) float MachNumber; //49 float IAS; //50 Indicated Air Speed byte CurrentStage; //51 Current stage number byte TotalStage; //52 TotalNumber of stages }; struct HandShakePacket { byte id; byte M1; byte M2; byte M3; }; struct ControlPacket { byte id; byte MainControls; //SAS RCS Lights Gear Brakes Precision Abort Stage byte Mode; //0 = stage, 1 = docking, 2 = map unsigned int ControlGroup; //control groups 1-10 in 2 bytes byte AdditionalControlByte1; //other stuff byte AdditionalControlByte2; int Pitch; //-1000 -> 1000 int Roll; //-1000 -> 1000 int Yaw; //-1000 -> 1000 int TX; //-1000 -> 1000 int TY; //-1000 -> 1000 int TZ; //-1000 -> 1000 int WheelSteer; //-1000 -> 1000 int Throttle; // 0 -> 1000 int WheelThrottle; // 0 -> 1000 }; HandShakePacket HPacket; VesselData VData; ControlPacket CPacket; void setup() { Serial.begin(38400); portOne.begin(38400); InitTxPackets(); } void loop() { input(); output(); } --------Utilities-------- void Indicators() { analogWrite(contr, bright); lcd.begin(16, 2); // Print a message to the LCD. lcd.setCursor(0,0); lcd.print("APPO:"); lcd.setCursor(5,0); lcd.print((long)VData.AP); lcd.setCursor(0,1); lcd.print("PERE:"); lcd.setCursor(5,1); lcd.print((long)VData.PE); portOne.println((long)VData.AP); //portOne.println("hello"); } void InitTxPackets() { HPacket.id = 0; CPacket.id = 101; }
  8. Well I could, but this works fine on KSP1_2_2 using KSP_Serial_IO-0.18.3 Why would it have changed?
  9. I'm having some difficulty getting my LCD display to work again for some reason. I have tested the LCD screen so I know it's working. Here is what I have in the KSPISO (tab) //lcd #include <LiquidCrystal.h> LiquidCrystal lcd(7, 6, 5, 4, 3, 2); Simple enough.. and this is what I have in the Utilities Tab...trying to get the AP and PE data to view. void Indicators() { lcd.begin(16, 2); // Print a message to the LCD. lcd.setCursor(0,0); lcd.print((long)VData.AP); lcd.setCursor(0,1); lcd.print((long)VData.PE); } void InitTxPackets() { HPacket.id = 0; CPacket.id = 101; } Nothing is showing up on the LCD screen. Am I missing something? I'm using current plugin with ksp1.3 . I have tested the kspido demo16 and that worked, so I don't think it's a version mess up.
  10. Hi everyone, Just wanted to thank you all for helping me out with this mod. I am away from my family for the holidays and this project has really taken my mind off everything. (well almost). I just got my LCD screens hooked up and going to start mounting it to my "Dashboard" this weekend. (That is if I can borrow a drill from work). Great Mod, and even better community! Here's the link to the Monstrosity that I created!!!!
  11. Thanks everyone, I figured it all out. I placed the meter between (2) 22k Ohms resistors. That got the output voltage of .24 volts when I write the pin to 255. Here is how I declared the statement. analogWrite(FUELG, map(VData.LiquidFuelS/VData.LiquidFuelTotS*100, 0, 100, 0, 255));
  12. Here is the link for the Meter I am using http://www.allelectronics.com/item/pmd-100ua/100-ua-dc-panel-meter/1.html If I write analogWrite (FUELG, 9); it pegs the meter out. It's showing .21 Volts from my Multi-Meter. So that would mean that I need to drop the 5V from the arduino down to .21 volts... Correct?
  13. ok...ok....I'm not thinking tonight. I forgot to take out the Caution Yellow LED statements which were also on pin 6. I also change the analogWrite Statement to analogWrite(FUELG, map(VData.LiquidFuel, 0, 100, 0, 10));
  14. Hi everyone, Finnaly got my shipment of goodies today!!! (LCD Screens, New LEDs, and a Analog Meter). I decided to start with my Analog meter to show the fuel depletion. I was reading post from and to @Mulbin on page 3, and got to writing. I do not have a 15v gauge like he started with. From what I see using the fade sketch, my meter will read from 1 to 10 before it pegs out. I defined the gauge as FUELG, 6 and did a simple analogWrite to the utilities tab. analogWrite(FUELG, map(VData.LiquidFuel, 0, 1, 0, 10)); I also made sure I set FUELG to OUTPUT. Now here is the strange thing.....the needle moves but only when the fuel is either at 25% or I go full throttle. Then it pegs out. If I hit the Z and X key, I can make the needle dance. Any ideas?
  15. I set it to 1, it was set to 2 by default. Still getting it. If I press X it will go back to about 25% throttle, and when I tap shift once, it will fall to 0. that being said, the ship is still throttled to about 25%
  16. Finally got it my Arduino to work with this Plugin, (I disabled the handshake and upgraded to KSP 1.2). I have been playing around with it all day. One problem however. My throttle is stuck at around 25% and it flicks up and down a little bit. When I unplug the Arduino and reload from the VAB it stops. I disabled the throttle control in the config file but I get the same result. Any Ideas?
  17. Ok here is a copy of my config file, <?xml version="1.0" encoding="utf-8"?> <config> <double name="refresh">0.2</double> <string name="DefaultPort">COM1</string> <int name="BaudRate">38400</int> <int name="HandshakeDelay">3000</int> <int name="HandshakeDisable">2</int> <int name="ThrottleEnable">2</int> <int name="PitchEnable">2</int> <int name="RollEnable">2</int> <int name="YawEnable">2</int> <int name="TXEnable">2</int> <int name="TYEnable">2</int> <int name="TZEnable">2</int> <int name="WheelSteerEnable">2</int> <int name="WheelThrottleEnable">2</int> <double name="SASTol">0.05</double> </config> I have tried all I can to get it to work without the ch340 usb-ttl convertor (which I ordered) but I still can't get it to work. I've set the handshake to 2 and even changed my Comm Ports, (both in the config and on my arduino) Any thoughts on what I am doing wrong? Thanks.
  18. Setting it to 1 will disable the handshake, correct? And I should set the com port to the same one the arduino software uses to upload sketches?
  19. From what I was reading, I thought that the Windows 10 glitch was for inputs to KSP only.
  20. Hi everyone. It's been a while scene I played around with the Arduino. I got everything hooked up for the warning LED demo. I can tell I am receiving a handshake (green led turns on for about a sec right before the Launch pad loads.) and I am getting a IO Awake and No Display Found notification on the top right of the screen. I am running Windows 10 and KSP 1.1.3 using a Arduino UNO. All LEDs have been tested so I know they work. I'm really running out of ideas as to why this won't talk. Any help would be appreciated. Thanks.
  21. Thanks I will try that this weekend to see if it works then start fiddling with it. Thanks for the clarification.
  22. Hi everyone. I am new to the Arduino and an avid KSP player. I really love this game. As I started to mess around with the Arduino I started to get a lot of good ideas and I started to look around for other great projects. This is by far the best project to work on. What I want to do is what Swonely is talking about, have external LCDs to give me data on Altitude and Radar Altitude things like that. I pretty much spent the last 2 days reading up all the posts here, but I am getting very confused on a lot of things. The biggest thing I am confused on is the Arduino code. I downloaded DEMO 4 and looked though the code, but there are several sketches. I thought (and pretty sure) the Arduino can only use one sketch at a time. Also I notice there is not void setup code in most, if not all the sketches. I want to test the Radar Alt function by having the Arduino println command display the value in the COM viewer, but I don't know how to fetch that data. If someone could please guide me in the right direction, it would be greatly appreciated.
×
×
  • Create New...