future python, older pip

•2017/10/30 • Comments Off on future python, older pip

python3.6 -m pip install vpython

Advertisements

Game of Life, in Python

•2017/09/08 • Comments Off on Game of Life, in Python
# playground has an extra row and column on each edge. 
#  this will remove the need to check for neighbors out of bounds.

MAXX = 11
MAXY = 11

import numpy

def neighborsAlive( x, y ):
  return playground[x-1][y-1]+playground[x][y-1]+playground[x+1][y-

1]+playground[x-1][y]+playground[x+1][y]+playground[x-1][y+1]+playground[x][y

+1]+playground[x+1][y+1]

playground = numpy.zeros(( MAXX+2, MAXY+2 ))

playground[3][3] = 0
playground[3][4] = 1
playground[3][5] = 1

playground[4][3] = 0
playground[4][4] = 0
playground[4][5] = 1

playground[5][3] = 1
playground[5][4] = 1
playground[5][5] = 1 	

playground[10][3] = 1
playground[10][4] = 1
playground[10][5] = 1 	

print( playground )

newlife = numpy.zeros(( MAXX+2, MAXY+2 ))

# only do 10 cylces
for i in [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]:
  print( "" )
  newlife = numpy.zeros(( MAXX+2, MAXY+2 ))
  for x in range( 1, MAXX+1 ):
    for y in range( 1, MAXY+1 ):
      myNeighbors = neighborsAlive(x,y)
      #print( playground[x][y], myNeighbors )

      # rules
      if playground[x][y] == 1:   # alive 
        #print( x, y, playground[x][y], myNeighbors )
        if myNeighbors < 2: newlife[x][y] = 0 else: if myNeighbors > 3:
            newlife[x][y] = 0
          else:
            newlife[x][y] = 1     # stay alive
      else:                       # dead
        if myNeighbors == 3:
          newlife[x][y] = 1

  print( newlife )
  # make the new one the current one for the next step
  playground = newlife

RRRduino without crystal

•2017/06/06 • Comments Off on RRRduino without crystal

https://www.arduino.cc/en/Tutorial/ArduinoToBreadboard

Arduino as ISP (after the Arduino UNO has been loaded with Examples->11.ArduioISP

Make sure the target has a why to run by itself with power and all ICSP pins are soldered.

Burn Bootloader on the correct COM.

Then use Uno without chip to Tx the real code in.

 

MQTT…

•2017/05/24 • Comments Off on MQTT…
sudo apt-get install mosquitto mosquitto-clients

mosquitto_pub -h 192.168.16.152 -t mast.0002 -r -m "Approach"     // -r for retain, -p 1883

mosquitto_sub -v -h 192.168.16.152 -t '#'          // -p 1883, subscribe to all
mast.0002 Approach

Upper to lowercase…in filenames…

•2017/02/25 • Comments Off on Upper to lowercase…in filenames…

Yes, I just don’t like external gadgets and very expensive drone cameras to save files as DJI_0717.MP4 … .mp4 is much easier on the eyes.

me@myPuter:~/myFolder$ rename 'y/A-Z/a-z/' *

OpenCV 3.1.0 installed in Ubuntu in 16.04.1 LTS

•2016/12/29 • Comments Off on OpenCV 3.1.0 installed in Ubuntu in 16.04.1 LTS

Could not do the same with OpenCV 3.2.0, but here is and excellent how to install 3.1.0, using python 3.5 in Ubuntu 16.04.1 LTS:

http://www.pyimagesearch.com/2016/10/24/ubuntu-16-04-how-to-install-opencv/

The compile part takes same time, so turn a movie on when you enter “make -j2”.

A note later why it is marked “trains”…

Dumb Arduino errors!

•2016/10/10 • Comments Off on Dumb Arduino errors!

irremote

“C:\Users\user\AppData\Local\Arduino15\packages\arduino\tools\arm-none-eabi-gcc\4.8.3-2014q1/bin/arm-none-eabi-g++” -mcpu=cortex-m0plus -mthumb -c -g -Os -w -std=gnu++11 -ffunction-sections -fdata-sections -fno-threadsafe-statics -nostdlib –param max-inline-insns-single=500 -fno-rtti -fno-exceptions -MMD -DF_CPU=48000000L -DARDUINO=10612 -DARDUINO_SAMD_ZERO -DARDUINO_ARCH_SAMD -D__SAMD21G18A__ -DUSB_VID=0x2341 -DUSB_PID=0x804d -DUSBCON ‘-DUSB_MANUFACTURER=”Arduino LLC”‘ ‘-DUSB_PRODUCT=”Arduino Zero”‘ “-IC:\Users\user\AppData\Local\Arduino15\packages\arduino\tools\CMSIS\4.0.0-atmel/CMSIS/Include/” “-IC:\Users\user\AppData\Local\Arduino15\packages\arduino\tools\CMSIS\4.0.0-atmel/Device/ATMEL/” “-IC:\Users\user\AppData\Local\Arduino15\packages\arduino\hardware\samd\1.6.6\cores\arduino” “-IC:\Users\user\AppData\Local\Arduino15\packages\arduino\hardware\samd\1.6.6\variants\arduino_zero” “-IC:\Users\user\Documents\Arduino\libraries\IRremote” “C:\Users\user\Documents\Arduino\libraries\IRremote\irISR.cpp” -o “C:\Users\user\AppData\Local\Temp\arduino_build_814138\libraries\IRremote\irISR.cpp.o”
C:\Users\user\Documents\Arduino\libraries\IRremote\irISR.cpp:18:5: error: expected constructor, destructor, or type conversion before ‘(‘ token

ISR (TIMER_INTR_NAME)

^

Using library IRremote at version 1.0 in folder: C:\Users\user\Documents\Arduino\libraries\IRremote
exit status 1
Error compiling for board Arduino/Genuino Zero (Programming Port).

Solution:

Yes, change the board to something different than Programming Port!

=======================================================