User Tools

Site Tools


motors-scanner-test-1

This is an old revision of the document!



Warning: Declaration of syntax_plugin_wrap_div::handle($match, $state, $pos, Doku_Handler &$handler) should be compatible with DokuWiki_Syntax_Plugin::handle($match, $state, $pos, Doku_Handler $handler) in /var/www/kucjica/emperors-wiki/lib/plugins/wrap/syntax/div.php on line 43

Warning: Declaration of syntax_plugin_wrap_div::render($mode, Doku_Renderer &$renderer, $indata) should be compatible with DokuWiki_Syntax_Plugin::render($format, Doku_Renderer $renderer, $data) in /var/www/kucjica/emperors-wiki/lib/plugins/wrap/syntax/div.php on line 81

Warning: Declaration of syntax_plugin_wrap_closesection::handle($match, $state, $pos, Doku_Handler &$handler) should be compatible with DokuWiki_Syntax_Plugin::handle($match, $state, $pos, Doku_Handler $handler) in /var/www/kucjica/emperors-wiki/lib/plugins/wrap/syntax/closesection.php on line 23

Warning: Declaration of syntax_plugin_wrap_closesection::render($mode, Doku_Renderer &$renderer, $indata) should be compatible with DokuWiki_Syntax_Plugin::render($format, Doku_Renderer $renderer, $data) in /var/www/kucjica/emperors-wiki/lib/plugins/wrap/syntax/closesection.php on line 29

Warning: Declaration of syntax_plugin_wrap_span::handle($match, $state, $pos, Doku_Handler &$handler) should be compatible with DokuWiki_Syntax_Plugin::handle($match, $state, $pos, Doku_Handler $handler) in /var/www/kucjica/emperors-wiki/lib/plugins/wrap/syntax/span.php on line 43

Warning: Declaration of syntax_plugin_wrap_span::render($mode, Doku_Renderer &$renderer, $indata) should be compatible with DokuWiki_Syntax_Plugin::render($format, Doku_Renderer $renderer, $data) in /var/www/kucjica/emperors-wiki/lib/plugins/wrap/syntax/span.php on line 63

Warning: Declaration of syntax_plugin_gallery::handle($match, $state, $pos, &$handler) should be compatible with DokuWiki_Syntax_Plugin::handle($match, $state, $pos, Doku_Handler $handler) in /var/www/kucjica/emperors-wiki/lib/plugins/gallery/syntax.php on line 51

Warning: Declaration of syntax_plugin_gallery::render($mode, &$R, $data) should be compatible with DokuWiki_Syntax_Plugin::render($format, Doku_Renderer $renderer, $data) in /var/www/kucjica/emperors-wiki/lib/plugins/gallery/syntax.php on line 147

Warning: Declaration of syntax_plugin_vshare::handle($match, $state, $pos, &$handler) should be compatible with DokuWiki_Syntax_Plugin::handle($match, $state, $pos, Doku_Handler $handler) in /var/www/kucjica/emperors-wiki/lib/plugins/vshare/syntax.php on line 47

Warning: Declaration of syntax_plugin_vshare::render($mode, &$R, $data) should be compatible with DokuWiki_Syntax_Plugin::render($format, Doku_Renderer $renderer, $data) in /var/www/kucjica/emperors-wiki/lib/plugins/vshare/syntax.php on line 107

Warning: preg_match(): Compilation failed: invalid range in character class at offset 3444 in /var/www/kucjica/emperors-wiki/inc/parser/lexer.php on line 118
A PCRE internal error occured. This might be caused by a faulty plugin

====== salzamt, linz, 11. 09. 2012 ====== airodump-ng is scanning the wifi this code parses the .csv file airodump is writing to and uses the value of '#IV's or the amount of data packets to send positional values to linear actuators. <code python> import subprocess, glob, time, csv from arduino import Arduino, Servo # scanning part ----------------- # airodump-ng is running and logging the results into a csv file # subprocess looks for the last edited csv file in current folder # this file is parsed by the csv module to find the number of data packets that have passed through the network since the last check listlasted=subprocess.Popen("ls -ct1 *csv | head -1", shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) lasted=listlasted.communicate()[0].strip() # reading the scan log from a csv file def lookup(dump): scan=open(dump) next(scan) scanDict=csv.DictReader(scan, delimiter=',') for adict in scanDict: if adict.has_key(' # IV'): data=adict.get(' # IV') return data #airodump='/home/selena/doc/synergia/sator/scanning/salzamt1109-01.csv' # moving part ------------------- portz=glob.glob("/dev/ttyUSB*")[0] #print portz my_board=Arduino(portz) my_board.output([9, 11]) linearone=my_board.attachServo(9) lineartwo=my_board.attachServo(11) position=40 linearone.write(position), lineartwo.write(position) time.sleep(1) packets=int(lookup(lasted)) print 'packets', packets time.sleep(10) while True: newPackets=int(lookup(airodump)) packetsDiff=newPackets-packets print 'packetsDiff', packetsDiff # decide whether to stretch or shrink: if packetsDiff>10: newPosition=position+(packetsDiff/5) print 'should stretch', newPosition if newPosition <=140: print 'and will do' linearone.write(newPosition), lineartwo.write(newPosition) else: print 'already at maximum' # reset position=120 elif packetsDiff<=0: newPosition=position-10 print 'shrinking', newPosition if newPosition >= 40: print 'will do' linearone.write(newPosition), lineartwo.write(newPosition) else: print 'already at minumum' position=50 time.sleep(5) packets=newPackets #resets the packets position=newPosition #resets the position (so the next time it will compare with the updated value) </code>

motors-scanner-test-1.1348398088.txt.gz · Last modified: 2012/09/23 11:01 by 85.218.109.130