-
Posts
640 -
Joined
-
Last visited
-
DIY strain gauge sensor for a Winwing Viper Grip
Vinc_Vega replied to DracuOrc's topic in Home Cockpits
I like your design! But isn't in reality the yaw axis controlled by the rudder pedals? If you really mean the grip's yaw, you should measure the applied torque. That's not easy but may be a calibrated and combined signal of all four strain gauges. It will be even harder to get the direction of the torque moment. Regards, Vinc- 2 replies
-
- strain gauge
- viper grip
-
(and 1 more)
Tagged with:
-
If this really will be the case, that would have been my last pre-purchased module. Regards, Vinc
-
@SrSosio As expected, you may have to change the declaration of bool status into int status to use the onSeatPositionChange function, even if the output would be either 0 or 1. Regards, Vinc Edit: it's a really great hack to use the dynamic sketch to even swith the function of a whole panel. Respect!
-
The seat function expects an integer but your status variable may still be declared as bool. I'll later have a look into the new sketch. Regards, Vinc
-
Not sure what the signal actually is triggered from. Just jump between the cockpits, read it out and you'll see. Regards, Vinc
-
No, as I don't have the AH-64 module I didn't had a look into it's code. But that sounds promising Regards, Vinc
-
I would try to completely replace the onAcftNameChange function with a reading of your selector switch Regards, Vinc
-
@SrSosio Sorry, that I misinterpreted the above postings as an output problem (I'm not a native English speaker). I now understand that you have duplicated your inputs. That's because you use the same keypress (e.g. pin 35) for pilot's and gunner's KU (here PLT_KU_2 and CPG_KU_2). Yes, "tryToSendDcsBiosMessage" is the kind of a function to directly send commands to DCS Bios. I used that a lot within the code for my VHF FM radio, to send switch positions of a port expander. Have a look into the source code of DcsBios to see that functionality: https://github.com/DCS-Skunkworks/dcs-bios-arduino-library/blob/master/src/DcsBios.h In short the arguments may be explained as follows: bool tryToSendDcsBiosMessage(const char* msg, const char* arg); char* msg can be the name of a switch, same like you have already used in your sketch (e.g. "CPG_KU_2" for key 2 of your gunner's keyboard or "PLT_KU_2" for that of the pilot). char* arg represents a value to be send to DCS Bios: for a two position switch it is either "0" or "1", or for multi position switches "0" to "max position (minus 1)". Btw. that function also can send all the other input arguments, like "INC" or "DEC" to increase or decrease values e.g. for a channel selector knob (like with the rotaries). Instead of tryToSendDcsBiosMessage you also can use sendDcsBiosMessage, but I recommend to leave it like that. So you are able to directly send switch positions to DCS Bios, like the reading for pin 35: if (digitalRead(35) == 0) DcsBios::tryToSendDcsBiosMessage("CPG_KU_2", "0"); if (digitalRead(35) == 1) DcsBios::tryToSendDcsBiosMessage("CPG_KU_2", "1"); (or the other way around if your switch is active LOW) Be carefull to use it within the LOOP section, as it than permanently sends the read values. I therefore used variables to hold the actual status and send it only in case it has changed. Have a look into my VHF FM radio sketch linked below. You may group your keyboard readings within different sections of a function. Imagine, that a key may be send either from the gunner's or the pilot's KU, depending on the position of your (status) selector switch (input A3). You may have an idea of what I mean. It's a lot of coding to be done, but on the other hand you build two separate input devices Regards, Vinc Edit: I had a further look into the DcsBios library but havn't worked with the DynamicControlMapping.ino example yet. If I understand the sketch right, it even may be adjusted to your input needs.
-
I can see your switch working. The possibility to input different content is by using the global variable (status 0/1) within each of the input (key) functions. You therefore cannot use the short DCS Bios statements. Edit: Read the button and than use functions for every key like DcsBios::tryToSendDcsBiosMessage("CPG_KU_2", "1"); Regards, Vinc
-
@SrSosio Okay, you may just declare two new variables within the header of your sketch String(CpgKuDisplay); String(PltKuDisplay); Then put the content of the DCS Bios strings into these variables and call the display to be updated void onCpgKuDisplayChange(char* newValue) { CpgKuDisplay = newValue; updateDisplay(); } DcsBios::StringBuffer<22> cpgKuDisplayBuffer(0x80ac, onCpgKuDisplayChange); void onPltKuDisplayChange(char* newValue) { PltKuDisplay = newValue; updateDisplay(); } DcsBios::StringBuffer<22> pltKuDisplayBuffer(0x808e, onPltKuDisplayChange); And lastly, use that function and dependent on the switch position print the variables to the LCD (function just simplified) void updateDisplay() { lcd.setCursor(0,0); if (status == 0) { lcd.print(CpgKuDisplay); } if (status == 1) { lcd.print(PltKuDisplay); } } That should print only one string to the display, even if both variables (strings) are updated. Regards, Vinc PS: you also may trim that strings (variables) and cut e.g. the first 8 chars before printing to the LCD.
-
@SrSosio Independent of the switch position, you will see no difference on the display. This code always prints an "yes" into the display if the first char of the string is a hash tag. void updateDisplay(char* newValue){ lcd.setCursor(0,0); if (newValue[0] == char(35)) lcd.print("yes"); } What if you dispose the "updateDisplay" function and put the code directly within the respective onDisplayChange parts? void onCpgKuDisplayChange(char* newValue) { if (status == 0) { if (newValue[0] == char(35)) { lcd.setCursor(0,0); lcd.print("Cpg"); } } } DcsBios::StringBuffer<22> cpgKuDisplayBuffer(0x80ac, onCpgKuDisplayChange); void onPltKuDisplayChange(char* newValue) { if (status == 1) { if (newValue[0] == char(35)) { lcd.setCursor(0,0); lcd.print("Plt"); } } } DcsBios::StringBuffer<22> pltKuDisplayBuffer(0x808e, onPltKuDisplayChange); Regards, Vinc Edit: How is it in the Simulator Cockpit? Doesn't the display ever show the same line, no matter which KU is in use? It may be intentionally, that e.g. the commander can see the pilot's input.
-
You may also try the plain ASCII code without the char() statement.
-
@SrSosio As characters are represented as signed bytes and for the hash tag the ASCII sign is 35, something like that may work for you if (newValue[0] == char(35)) Regards, Vinc
-
@SrSosio Can you read out some lines, e.g. by using the Bort software and copy the line content? We than my see if there are some unusual characters like a cursor or so. Regards, Vinc