Jump to content

Freakout242

Members
  • Posts

    25
  • Joined

  • Last visited

Reputation

2 Neutral

Profile Information

  • About me
    Very Tired Project Guy

Recent Profile Visitors

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

  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?
×
×
  • Create New...