Jump to content

Adrian_gc

Members
  • Posts

    39
  • Joined

  • Last visited

Everything posted by Adrian_gc

  1. Same problem here Same problem here with 1080 ti SLI. With single 1080 ti no problem. Any solution?
  2. Must to be place a little more to the left in the picture?
  3. Thanks to Captain Orso and Holton181,,,,with the example mission and the modified script it is clear to see and it works,,,thanks so much for the help !!!!
  4. I thank you very much for the time you are investing in helping me out! At first I thought that those 4800 ft were the 1500 meters, but no, it's pure coincidence. in fact, it varies the data of minalt and maxalt ,,, always activates the "rolling in" to 4800 ft, independently of the values that they put. Maybe it is the mist........ who places the entrance of the airplane at that height inside the polygon created by the waypoints ...i dont know.... All this problem is generated because when we create the range of shooting at sea level, the trigger star to 4800 ft .... and more or less you open fire with the gun at about 1000 ft ... or more. But when you create the range shot in Nevada, the average height is 5000 ft, at which ..... the trigger is activated at about 500 ft above the ground.
  5. Yes, I have done it, the values of maxalt and minalt are not to vary the activation height of the trigger, which is always activated at 4800 ft above sea level. I do not know if it is an option to vary in the mission editor, in the mist or in the script itself ...
  6. Hello, I have changed the values of maxAlt and it does not affect anything at the height of trigger detection ..... which is always close to 4800 ft above sea level, and that is the altitude that I would like to vary, only the 4800 ft in order to activate it higher. Here a Copy of the Script: -- DCS - Simple Range Script -- Version 1.1 -- By Ciribob - https://github.com/ciribob/DCS-SimpleRangeScript -- -- Change log: -- - Added more accuracte target distance measurement -- - Added weapon name for bombing range to scoreboard -- -- Requires MIST 4.0.57 or newer! -- Inspired by Original Script by SNAFU http://forums.eagle.ru/showthread.php?t=109174 range = {} range.strafeTargets = { { -- GROUP NAME for the unit whos waypoints enclose the target name = "left_zone", minAlt = 500, maxAlt = 1500, goodPass = 20, targets = {'Strafe pit Left 3','Strafe pit Left 2','Strafe pit Left 1'}, -- which target(s) are valid for this zone - Unit Names }, { name = "right_zone", -- GROUP NAME for the unit whos waypoints enclose the target minAlt = 500, maxAlt = 1500, goodPass = 20, targets = {'Strafe pit Right 3','Strafe pit Right 2','Strafe pit Right 1'}, -- which target(s) are valid for this zone - Unit Names } } -- Zone Names range.bombingMinAlt = 1800 range.bombingTargets = { "target1", "target2", "target3", "target4", "target5", "target6", "target7", "target8", "target9", "target10", "target11", "target12", "target13", "target14", "target15", } function range.displayMyStrafePitResults(_unitName) local _unit = Unit.getByName(_unitName) if _unit and _unit:getPlayerName() then local _message = "My Top 10 Strafe Pit Results: \n" local _results = range.strafePlayerResults[_unit:getPlayerName()] if _results == nil then _message = _unit:getPlayerName()..": No Score yet" else local _sort = function( a,b ) return a.hits > b.hits end table.sort(_results,_sort) local _bestMsg = "" local _count = 1 for _,_result in pairs(_results) do _message = _message.."\n"..string.format("%s - Hits %i - %s",_result.zone.name,_result.hits,_result.text) if _bestMsg == "" then _bestMsg = string.format("%s - Hits %i - %s",_result.zone.name,_result.hits,_result.text) end -- 10 runs if _count == 10 then break end _count = _count+1 end _message = _message .."\n\nBEST: ".._bestMsg end range.displayMessageToGroup(_unit, _message, 10,false) end end function range.displayStrafePitResults(_unitName) local _unit = Unit.getByName(_unitName) local _playerResults = {} if _unit and _unit:getPlayerName() then local _message = "Strafe Pit Results - Top 10:\n" for _playerName,_results in pairs(range.strafePlayerResults) do local _best = nil for _,_result in pairs(_results) do if _best == nil or _result.hits > _best.hits then _best = _result end end if _best ~= nil then table.insert(_playerResults,{msg = string.format("%s: %s - Hits %i - %s",_playerName,_best.zone.name,_best.hits,_best.text),hits = _best.hits}) end end --sort list! local _sort = function( a,b ) return a.hits > b.hits end table.sort(_playerResults,_sort) for _i = 1, #_playerResults do _message = _message.."\n[".._i.."]".._playerResults[_i].msg --top 10 if _i > 10 then break end end range.displayMessageToGroup(_unit, _message, 10,false) end end function range.resetRangeStats(_unitName) local _unit = Unit.getByName(_unitName) if _unit and _unit:getPlayerName() then range.strafePlayerResults[_unit:getPlayerName()] = nil range.bombingTargets[_unit:getPlayerName()] = nil range.displayMessageToGroup(_unit, "Range Stats Cleared", 10,false) end end function range.displayMyBombingResults(_unitName) local _unit = Unit.getByName(_unitName) if _unit and _unit:getPlayerName() then local _message = "My Top 20 Bombing Results: \n" local _results = range.bombPlayerResults[_unit:getPlayerName()] if _results == nil then _message = _unit:getPlayerName()..": No Score yet" else local _sort = function( a,b ) return a.distance < b.distance end table.sort(_results,_sort) local _bestMsg = "" local _count = 1 for _,_result in pairs(_results) do _message = _message.."\n"..string.format("%s - %s - %i m",_result.name,_result.weapon,_result.distance) if _bestMsg == "" then _bestMsg = string.format("%s - %s - %i m",_result.name,_result.weapon,_result.distance) end -- 20 runs if _count == 20 then break end _count = _count+1 end _message = _message .."\n\nBEST: ".._bestMsg end range.displayMessageToGroup(_unit, _message, 10,false) end end function range.displayBombingResults(_unitName) local _unit = Unit.getByName(_unitName) local _playerResults = {} if _unit and _unit:getPlayerName() then local _message = "Bombing Results - Top 15:\n" for _playerName,_results in pairs(range.bombPlayerResults) do local _best = nil for _,_result in pairs(_results) do if _best == nil or _result.distance < _best.distance then _best = _result end end if _best ~= nil then table.insert(_playerResults,{msg = string.format("%s: %s - %s - %i m",_playerName,_best.name,_best.weapon,_best.distance),distance = _best.distance}) end end --sort list! local _sort = function( a,b ) return a.distance < b.distance end table.sort(_playerResults,_sort) for _i = 1, #_playerResults do _message = _message.."\n[".._i.."] ".._playerResults[_i].msg --top 15 if _i > 15 then break end end range.displayMessageToGroup(_unit, _message, 10,false) end end -- Handles all world events range.eventHandler = {} function range.eventHandler:onEvent(_eventDCS) if _eventDCS == nil or _eventDCS.initiator == nil then return true end local status, err = pcall(function(_event) if _event.id == 15 then --player entered unit -- env.info("Player entered unit") if _event.initiator:getPlayerName() then -- reset current status range.strafeStatus[_event.initiator:getID()] = nil range.addF10Commands(_event.initiator:getName()) if range.planes[_event.initiator:getID()] ~= true then range.planes[_event.initiator:getID()] = true range.checkInZone(_event.initiator:getName()) end end return true elseif _event.id == world.event.S_EVENT_HIT and _event.target then -- env.info("HIT! ".._event.target:getName().." with ".._event.weapon:getTypeName()) --_event.weapon is currently broken for clients -- env.info(_event.initiator:getPlayerName().."HIT! ".._event.target:getName().." with ".._event.weapon:getTypeName()) -- trigger.action.outText("HIT! ".._event.target:getName().." with ".._event.weapon:getTypeName(),10,false) local _currentTarget = range.strafeStatus[_event.initiator:getID()] if _currentTarget then for _, _targetName in pairs(_currentTarget.zone.targets) do if _targetName == _event.target:getName() then _currentTarget.hits = _currentTarget.hits + 1 return true end end end elseif _event.id == world.event.S_EVENT_SHOT then local _weapon = _event.weapon:getTypeName() local _weaponStrArray = range.split(_weapon,"%.") local _weaponName = _weaponStrArray[#_weaponStrArray] if (string.match(_weapon, "weapons.bombs") --all bombs or string.match(_weapon, "weapons.nurs") --all rockets -- or _weapon == "weapons.bombs.BDU_50HD" -- or _weapon == "weapons.bombs.BDU_50LD" -- or _weapon == "weapons.nurs.HYDRA_70_M274" -- or _weapon == "weapons.bombs.BDU_33" ) and _event.initiator:getPosition().p.y > range.bombingMinAlt then local _ordnance = _event.weapon env.info("Tracking ".._weapon.." - ".._ordnance:getName()) local _lastBombPos = {x=0,y=0,z=0} local _unitName = _event.initiator:getName() local trackBomb = function(_previousPos) local _unit = Unit.getByName(_unitName) -- env.info("Checking...") if _unit ~= nil and _unit:getPlayerName() ~= nil then -- when the pcall returns a failure the weapon has hit local _status,_bombPos = pcall(function() -- env.info("protected") return _ordnance:getPoint() end) if _status then --ok! still in the air _lastBombPos = {x = _bombPos.x, y = _bombPos.y, z= _bombPos.z } return timer.getTime() + 0.005 -- check again ! else --hit -- get closet target to last position local _closetTarget = nil local _distance = nil for _,_targetZone in pairs(range.bombingTargets) do local _temp = range.getDistance(_targetZone.point, _lastBombPos) if _distance == nil or _temp < _distance then _distance = _temp _closetTarget = _targetZone end end -- env.info(_distance.." from ".._closetTarget.name) if _distance < 1000 then if not range.bombPlayerResults[_unit:getPlayerName()] then range.bombPlayerResults[_unit:getPlayerName()] = {} end local _results = range.bombPlayerResults[_unit:getPlayerName()] table.insert(_results,{name=_closetTarget.name, distance =_distance, weapon = _weaponName }) local _message = string.format("%s - %i m from bullseye of %s",_unit:getPlayerName(), _distance,_closetTarget.name) trigger.action.outText(_message,10,false) end end end return end timer.scheduleFunction(trackBomb, nil, timer.getTime() + 1) end end return true end, _eventDCS) if (not status) then env.error(string.format("Error while handling event %s", err),false) end end function range.checkInZone(_unitName) --check if we're in any zone -- if we're in a zone, start looking for hits on target -- if we're no longer in a zone but were previously, list the result and store the run local _unit = Unit.getByName(_unitName) if _unit and _unit:getPlayerName() then timer.scheduleFunction(range.checkInZone, _unitName, timer.getTime() + 1) local _unitPos = _unit:getPosition().p -- currently strafing? local _currentStrafeRun = range.strafeStatus[_unit:getID()] if _currentStrafeRun ~= nil then if _currentStrafeRun.zone.polygon~=nil and mist.pointInPolygon(_unitPos,_currentStrafeRun.zone.polygon,_currentStrafeRun.zone.maxAlt) and _unitPos.y >= _currentStrafeRun.zone.minAlt then --still in zone, do nothing _currentStrafeRun.time = _currentStrafeRun.time+1 elseif _currentStrafeRun.zone.polygon~=nil then _currentStrafeRun.time = _currentStrafeRun.time+1 if _currentStrafeRun.time <= 3 then range.strafeStatus[_unit:getID()] = nil local _msg = _unit:getPlayerName()..": left ".._currentStrafeRun.zone.." too quickly. No Score. " range.displayMessageToGroup(_unit, _msg, 10,true) else local _result = range.strafeStatus[_unit:getID()] local _msg = _unit:getPlayerName().." " if _result.hits >= _result.zone.goodPass then _msg = _msg .."GOOD PASS with ".._result.hits.." on " _result.text = "GOOD PASS" else _msg = _msg .."INEFFECTIVE PASS with ".._result.hits.." on " _result.text = "INEFFECTIVE PASS" end _msg = _msg .._result.zone.name trigger.action.outText(_msg,10,false) range.strafeStatus[_unit:getID()] = nil -- Save so the player can retrieve them local _stats = range.strafePlayerResults[_unit:getPlayerName()] or {} table.insert(_stats,_result) range.strafePlayerResults[_unit:getPlayerName()] = _stats end end else -- check to see if we're in a zone for _,_targetZone in pairs(range.strafeTargets) do if _targetZone.polygon~=nil and mist.pointInPolygon(_unitPos,_targetZone.polygon,_targetZone.maxAlt) then if range.strafeStatus[_unit:getID()] == nil and _unitPos.y >= _targetZone.minAlt then range.strafeStatus[_unit:getID()] = {hits = 0, zone = _targetZone, time = 1 } local _msg = _unit:getPlayerName().." Rolling in on ".._targetZone.name range.displayMessageToGroup(_unit, _msg, 10,true) end break end end end else timer.scheduleFunction(range.checkInZone, _unitName, timer.getTime() + 5) end end function range.getGroupId(_unit) local _unitDB = mist.DBs.unitsById[tonumber(_unit:getID())] if _unitDB ~= nil and _unitDB.groupId then return _unitDB.groupId end return nil end function range.displayMessageToGroup(_unit, _text, _time,_clear) local _groupId = range.getGroupId(_unit) if _groupId then if _clear == true then trigger.action.outTextForGroup(_groupId, _text, _time,_clear) else trigger.action.outTextForGroup(_groupId, _text, _time) end end end --range.gunTypes ={"weapons.shells.GAU8_30_AP","weapons.shells.GAU8_30_HE","weapons.shells.GAU8_30_TP","weapons.shells.M61_20_HE","weapons.shells.M61_20_AP","weapons.shells.M2_12_7_t","weapons.shells.7_62x51","weapons.shells.M134_7_62_T","weapons.shells.M134_7_62x51", -- "weapons.shells.M20_50_aero_APIT","weapons.shells.M20_50_aero_APIT","weapons.shells.GSH301_30_HE","weapons.shells.GSH301_30_AP","weapons.shells.GSH23_23_HE_T","weapons.shells.2A42_30_HE","weapons.shells.2A42_30_AP","weapons.shells.GSH23_23_HE_T", -- "weapons.shells.YakB_12_7_T","weapons.shells.YakB_12_7","weapons.shells.PKT_7_62_T","weapons.shells.PKT_7_62","weapons.shells.VOG17"} range.addedTo = {} function range.addF10Commands(_unitName) local _unit = Unit.getByName(_unitName) if _unit then local _group = mist.DBs.unitsById[tonumber(_unit:getID())] if _group then local _gid = _group.groupId if not range.addedTo[_gid] then range.addedTo[_gid] = true local _rootPath = missionCommands.addSubMenuForGroup(_gid, "Range") missionCommands.addCommandForGroup(_gid,"My Strafe results", _rootPath, range.displayMyStrafePitResults, _unitName) missionCommands.addCommandForGroup(_gid,"All Strafe results", _rootPath, range.displayStrafePitResults, _unitName) missionCommands.addCommandForGroup(_gid,"My Bombing results", _rootPath, range.displayMyBombingResults, _unitName) missionCommands.addCommandForGroup(_gid,"All Bombing results", _rootPath, range.displayBombingResults, _unitName) missionCommands.addCommandForGroup(_gid,"Reset Stats", _rootPath, range.resetRangeStats, _unitName) end end end end --get distance in meters assuming a Flat world function range.getDistance(_point1, _point2) local xUnit = _point1.x local yUnit = _point1.z local xZone = _point2.x local yZone = _point2.z local xDiff = xUnit - xZone local yDiff = yUnit - yZone return math.sqrt(xDiff * xDiff + yDiff * yDiff) end --http://stackoverflow.com/questions/1426954/split-string-in-lua function range.split(str, sep) local result = {} local regex = ("([^%s]+)"):format(sep) for each in str:gmatch(regex) do table.insert(result, each) end return result end --init range.strafeStatus = {} range.strafePlayerResults = {} range.bombPlayerResults = {} range.planes = {} for _,_targetZone in pairs(range.strafeTargets) do if Group.getByName(_targetZone.name) then local _points = mist.getGroupPoints(_targetZone.name) env.info("Done for: ".._targetZone.name) _targetZone.polygon = _points else env.info("Couldn't find: ".._targetZone.name) _targetZone.polygon = nil end end local _tempTargets = range.bombingTargets range.bombingTargets = {} for _,_targetZone in pairs(_tempTargets) do local _triggerZone = trigger.misc.getZone(_targetZone) if _triggerZone then table.insert(range.bombingTargets,{name=_targetZone,point=_triggerZone.point}) env.info("Done for: ".._targetZone) else env.info("Failed for: ".._targetZone) end end world.addEventHandler(range.eventHandler)
  7. Hello, could someone give me a hand? In this Script in reference to the Strafe pit, the height at which the specific scrip is activated inside the polygon drawn by the unit waypoints that we place as "left_zone", this is always activated at about 4900 ft height ASL ,,, Is there any way to make that height vary? the rest of the scrip works perfectly, the only one that in Nevada, is activated very close to the ground and I would like to adjust it. Thank you. I dont know if it can be adjunst in the scrip lua or in the mist...!!!
  8. Thanks so much for the help, it works !!!!
  9. Hello, I would like to know if there is any way to make an airplane, which is flying on a route, after being intercepted by a fighter, land at a specific airport. I have managed to add a moving zone of 100 meters in diameter to the plane that I want to intercept. After 30 second of intercept the moving zone i would like to actived a trigger action that force plane to land,,,but how? Script?
  10. In truth I would tell you that it would be great for VR, but I am starting to believe that it is Photoshop!
  11. Hi Sydy, thanks for the Help...i followed the instructions and in principle I do not see that they work in the pilot's body. it only works on the kneeboard by pressing RShift + K. Do you see the Check list of the F-18 in the Kneeboard in the body pilot? Instructions: Extract this inside of "C:\Users"your name"\Saved Games\DCS.openbeta"...........OK Check if the files are in the "C:\Users"your name"\Saved Games\DCS.openbeta\Kneeboard\FA-18C_hornet" folder.............OK
  12. Here: https://forums.eagle.ru/showthread.php?t=189354&page=17 In the bottom of the post (post 165) you have an image, what I do not know if it is from the simulator or photoshop !!!
  13. Definitely I do not work, I tried all the options already mentioned in the post and I can not see the image on the pilot's leg
  14. Some help please? I can not make it work
  15. i have the pilot body enable too, but i see on the leg the missing texture in the kneeboard. With Shift+k i see the kneeboard without problems. The problem is on the body pilot,,,,not getting works.
  16. I have the same problem here. I followed the instructions, I created the folder but I still see the missing texture in the kneeborad (on pilot body).
  17. Hi, for example and it is only my personal opinion, you can use a "push pull pot". http://www.stewmac.com/Pickups_and_Electronics/Components_and_Parts/Potentiometers/CTS_Push-pull_Pots_SPST.html Hope this help you!!!
  18. Hi I am trying to setup the code for the CDU of "robinmli" to my adafruit TFT 3.5" screen and i get more compilation mistake: CDU code: #define DCSBIOS_IRQ_SERIAL #include <Adafruit_GFX.h> #include "Adafruit_HX8357.h" #include "DcsBios.h" // These are 'flexible' lines that can be changed #define TFT_CS 10 #define TFT_DC 9 #define TFT_RST 8 // RST can be set to -1 if you tie it to Arduino's reset Adafruit_HX8357 tft = Adafruit_HX8357(TFT_CS, TFT_DC, TFT_RST); void printChar(int row, int col, unsigned char c) { int16_t x = 13 + col * 19; int16_t y = row * 32 + 6; tft.drawChar(x, y, c, 0x07E0, 0x0, 3); } /* paste code snippets from the reference documentation here */ void onCduLine0Change(char* newValue) { for(int i = 0; i < 24; i++){ printChar(0, i, newValue); } } DcsBios::StringBuffer<24> cduLine0Buffer(0x11c0, onCduLine0Change); void onCduLine1Change(char* newValue) { for(int i = 0; i < 24; i++){ printChar(1, i, newValue); } } DcsBios::StringBuffer<24> cduLine1Buffer(0x11d8, onCduLine1Change); void onCduLine2Change(char* newValue) { for(int i = 0; i < 24; i++){ printChar(2, i, newValue); } } DcsBios::StringBuffer<24> cduLine2Buffer(0x11f0, onCduLine2Change); void onCduLine3Change(char* newValue) { for(int i = 0; i < 24; i++){ printChar(3, i, newValue); } } DcsBios::StringBuffer<24> cduLine3Buffer(0x1208, onCduLine3Change); void onCduLine4Change(char* newValue) { for(int i = 0; i < 24; i++){ printChar(4, i, newValue); } } DcsBios::StringBuffer<24> cduLine4Buffer(0x1220, onCduLine4Change); void onCduLine5Change(char* newValue) { for(int i = 0; i < 24; i++){ printChar(5, i, newValue); } } DcsBios::StringBuffer<24> cduLine5Buffer(0x1238, onCduLine5Change); void onCduLine6Change(char* newValue) { for(int i = 0; i < 24; i++){ printChar(6, i, newValue); } } DcsBios::StringBuffer<24> cduLine6Buffer(0x1250, onCduLine6Change); void onCduLine7Change(char* newValue) { for(int i = 0; i < 24; i++){ printChar(7, i, newValue); } } DcsBios::StringBuffer<24> cduLine7Buffer(0x1268, onCduLine7Change); void onCduLine8Change(char* newValue) { for(int i = 0; i < 24; i++){ printChar(8, i, newValue); } } DcsBios::StringBuffer<24> cduLine8Buffer(0x1280, onCduLine8Change); void onCduLine9Change(char* newValue) { for(int i = 0; i < 24; i++){ printChar(9, i, newValue); } } DcsBios::StringBuffer<24> cduLine9Buffer(0x1298, onCduLine9Change); void setup() { DcsBios::setup(); tft.begin(HX8357D); tft.setRotation(1); tft.fillScreen(HX8357_BLACK); tft.setTextSize(3); tft.setTextColor(HX8357_GREEN, HX8357_BLACK); imprimeLinea (0, "OK RDY" ) ; } void imprimeLinea (int linea, char* newValue){ tft.setCursor(0, 30*linea); tft.print(newValue); } void loop() { DcsBios::loop(); } Compilation mistake: Arduino: 1.6.8 (Windows 10), Board: "Arduino/Genuino Uno" C:\Users\Adrian\AppData\Local\Temp\build920689b920 17d6a575dd53eca4c7e54f.tmp/core\core.a(HardwareSerial0.cpp.o): In function `__vector_18': C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/HardwareSerial0.cpp:48: multiple definition of `__vector_18' sketch\DCS_CDU_DISPLAY.ino.cpp.o:C:\Users\Adrian\D ocuments\Arduino\libraries\dcs-bios-arduino-library-0.2.1/DcsBios.h:40: first defined here collect2.exe: error: ld returned 1 exit status exit status 1 Error compiling for board Arduino/Genuino Uno. Any Idea ? Thanks so much !!! Note: at the moment is with arduino uno and i know that is going to be too slowly,,,,,first of all i am trying get it work,,,slow but work, after this will try to work a little fast.
  19. Hi Ian, thanks so much for help to me, i don´t know this order !!!
  20. Hey guys, I'm trying to compile a simple sketch using the new expalmes od arduino library 0.2.1 on DCS-BIOS.... any reference line containing a servo and not get it to work. I copied the example and the failure of compilation that gives me to see if you can help me: Code: Example for flaps posotion indicator gauge: #define DCSBIOS_IRQ_SERIAL #include "DcsBios.h" #include <Servo.h> DcsBios::ServoOutput flapPos(0x10a0, 5, 544, 2400); /* paste code snippets from the reference documentation here */ void setup() { DcsBios::setup(); } void loop() { DcsBios::loop(); } Compilation fail: Arduino:1.6.7 (Windows 10), Placa:"Arduino/Genuino Uno" aa:14: error: 'ServoOutput' in namespace 'DcsBios' does not name a type DcsBios::ServoOutput flapPos(0x10a0, 5, 544, 2400); ^ exit status 1 'ServoOutput' in namespace 'DcsBios' does not name a type Any Idea. Thanks so much !!!!
  21. Hi Patriot, could you explain what exactly we must to modify on DCS-BIOS please? Thanks so much !!!
  22. Hi Deadman !!!!! , remember that i am too interesting in get yours knobs too !!!!!!!
  23. Hi, I need help with the representation of height in an OLED display. I have write a code on arduino uno using DCS-BIOS to represent the height in an OLED display. When I run the program and the airplane is on the ground, the display shows up perfectly, if I turn the Rotary altimeter also perfectly synchronized shows. The problem happens when the plane is in flight. It is seen on the screen height is represented with a mix of numbers, usually the "3" ... "333" as if it were an interference. After leaving the plane on autopilot stable, the screen displays the most stable height, still, occasionally remixed numbers. Here I attached a copy of the code I'm using, also 2 videos of what happens on the ground and in flight. Anyone would think that might be happening? thank you. Videos: [ame]https://www.youtube.com/watch?v=3Q2jVzB1wVY[/ame] [ame] [/ame] Code: #include <DcsBios.h> #include <Servo.h> #include <SPI.h> #include <Wire.h> #include <Adafruit_GFX.h> #include <Adafruit_SSD1306.h> #define OLED_MOSI 9 #define OLED_CLK 10 #define OLED_DC 11 #define OLED_CS 12 #define OLED_RESET 13 Adafruit_SSD1306 display(OLED_MOSI, OLED_CLK, OLED_DC, OLED_RESET, OLED_CS); #if (SSD1306_LCDHEIGHT != 32) #error("Height incorrect, please fix Adafruit_SSD1306.h!"); #endif char primer='-'; char segundo='-'; char tercero='-'; char cuarto='0'; char quinto='0'; char writing=0; int val=0; /**** In most cases, you do not have to change anything below this line ****/ /* Instantiate a ProtocolParser object to parse the DCS-BIOS export stream */ DcsBios::ProtocolParser parser; void setup() { Serial.begin(500000); display.begin(SSD1306_SWITCHCAPVCC, 0x3C); display.clearDisplay(); } /* Your main loop needs to pass data from the DCS-BIOS export stream to the parser object you instantiated above. It also needs to call DcsBios::PollingInput::pollInputs() to detect changes in the state of connected controls and pass them on to DCS. */ void loop() { char pepe[6]; // feed incoming data to the parser while (Serial.available()) { parser.processChar(Serial.read()); } // poll inputs DcsBios::PollingInput::pollInputs(); sprintf(pepe, "%c%c%cA%c", primer, segundo, tercero, cuarto, quinto); writing=1; display.clearDisplay(); display.setTextSize(3); display.setTextColor(WHITE); display.setCursor(30,5); display.write(primer); display.write(segundo); display.write(tercero); display.write(cuarto); display.write(quinto); //display.println(); display.display(); delay (75); writing=0; } /* You need to define void sendDcsBiosMessage(const char* msg, const char* arg) so that the string msg, followed by a space, the string arg and a newline gets sent to the DCS-BIOS import stream. In this example we send it to the serial port, so you need to run socat to read the data from the serial port and send it over UDP to DCS-BIOS. If you are using an Ethernet Shield, you would probably want to send a UDP packet from this subroutine. */ void sendDcsBiosMessage(const char* msg, const char* arg) { Serial.write(msg); Serial.write(' '); Serial.write(arg); Serial.write('\n'); } char mapeo(unsigned int valor){ if (valor < 6553) { return '0'; } if (valor < 13107) { return '1'; } if (valor < 19660) { return '2'; } if (valor < 26214) { return '3'; } if (valor < 32767) { return '4'; } if (valor < 39321) { return '5'; } if (valor < 45874) { return '6'; } if (valor < 52428) { return '7'; } if (valor < 58981) { return '8'; } return '9' ; } /* This subroutine gets called every time a message is received from the export stream (you need to define it even if it does nothing). Use this to handle outputs which are not covered by the DcsBios Arduino library (e.g. displays). */ void onDcsBiosWrite(unsigned int address, unsigned int value) { if (!writing){ if (address == 0x1080) { primer=mapeo(value); } else if (address == 0x1082) { segundo=mapeo(value); } else if (address == 0x1084) { tercero=mapeo(value); } } }
  24. Hello Hogtie, first tell you that the VID60-02 engine, in my case, I have found only by www.Aliexpress.com ...... could be that I had elsewhere, but no idea. The engine has taught me is not the best suited for this, it does not have enough speed and acceleration capability. The good thing is that VID60-02 and comes with a built-in IR receiver. Here are the web where I usually buy, the you can buy one at a time or in batches of 10 as I usually do. http://es.aliexpress.com/store/product/VID60-02-VID60-02/1003209_32359506948.html?spm=2114.04020208.3.1.B5xZEm&ws_ab_test=searchweb201556_1,searchweb201644_1_79_78_77_82_80_62_81,searchweb201560_4 Almost any stepper motor will be mounted detection system from scratch, that's consumer tastes, I only tell you this is that more people recommended to me and it works for me fine. The code that I use to move these engines was not created by me,it was created by another friend of the forum that helped to me. After this I've been testing it and varying data, to achieve what I wanted in each instrument. I have link to you a video of my youtube chanel with a video moving the left needle of the fuel gauge, it is a fast and dirty video of a test only, sorry for quality !!!! Is this what are you looking? [ame] [/ame] Tomorrow i work complete day , on two days i can explain to you how to do it !!!
  25. Hello Hogtie !!!!!, i am Adrian, recently Warthog helped me a lot to me with the issue of stepper motors. I plan to publish soon a post about how I made the Altimeter and VVI instruments. So, by the way, you can get an idea, you need a stepper motor (Warhog showed me the VID60-02), an IR emitter, an Arduino Uno, a 10KOh... 250mOh resistor and a few cables. With this material you do that this instruments work well. Now, I'm testing with EASY DRIVER BOARD too, to give greater fluidity to the movement of the needle in the field of microstepping, but this last I'm just trying at the moment. If you want, I can lend a hand and tell you what I learned.
×
×
  • Create New...