From bf20d1ec00bf06087af375f70613f208a7b345d5 Mon Sep 17 00:00:00 2001
From: Christian Taedcke <hacking@taedcke.com>
Date: Thu, 11 Feb 2016 23:21:31 +0100
Subject: [PATCH 7/8] Python examples now run with python 2 and 3.

---
 examples/python/adc.py         |  4 ++--
 examples/python/ex_pinout.py   |  1 +
 examples/python/example_pin.py | 17 ++++++++---------
 3 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/examples/python/adc.py b/examples/python/adc.py
index 1cb0749..e0a3a75 100644
--- a/examples/python/adc.py
+++ b/examples/python/adc.py
@@ -32,12 +32,12 @@ if __name__ == "__main__":
   aref = XPin(dev, "AREF", 'a')
   
   INT_MAX = 2**31 - 1
-  aref.SetAnalog(INT_MAX)
+  aref.SetAnalogValue(INT_MAX)
   # hwad.cpp: adSample= (int)((float)adSample/(float)adref*INT_MAX);
   
   sim.dmanStart()
   print("simulation start: (t=%dns)" % sim.getCurrentTime())
-  a0.SetAnalog(123)
+  a0.SetAnalogValue(123)
   
   print("run till main function ...")
   bpaddr = dev.Flash.GetAddressAtSymbol("main")
diff --git a/examples/python/ex_pinout.py b/examples/python/ex_pinout.py
index 2be2220..2596d8d 100644
--- a/examples/python/ex_pinout.py
+++ b/examples/python/ex_pinout.py
@@ -1,4 +1,5 @@
 # Python Script
+from __future__ import print_function
 from sys import argv
 from os.path import splitext, basename
 
diff --git a/examples/python/example_pin.py b/examples/python/example_pin.py
index 4184807..e85b92b 100644
--- a/examples/python/example_pin.py
+++ b/examples/python/example_pin.py
@@ -1,4 +1,5 @@
 # Python Script
+from __future__ import print_function
 import pysimulavr
 
 class XPin(pysimulavr.Pin):
@@ -13,16 +14,14 @@ class XPin(pysimulavr.Pin):
     
 def printPin(pid, pin, withID = False):
   if withID:
-    print("  pin %d: id=%s, (char)pin='%s', (bool)pin=%s, pin.GetAnalogValue(vcc)=%0.2fV" % (pid,
-                                                                                             id(pin),
-                                                                                             pin.toChar(),
-                                                                                             pin.toBool(),
-                                                                                             pin.GetAnalogValue(vcc)))
+    print("  pin %d: id=%s, (char)pin='%s', pin.GetAnalogValue(vcc)=%0.2fV" % (pid,
+                                                                               id(pin),
+                                                                               pin.toChar(),
+                                                                               pin.GetAnalogValue(vcc)))
   else:
-    print("  pin %d: (char)pin='%s', (bool)pin=%s, pin.GetAnalogValue(vcc)=%0.2fV" % (pid,
-                                                                                      pin.toChar(),
-                                                                                      pin.toBool(),
-                                                                                      pin.GetAnalogValue(vcc)))
+    print("  pin %d: (char)pin='%s', pin.GetAnalogValue(vcc)=%0.2fV" % (pid,
+                                                                        pin.toChar(),
+                                                                        pin.GetAnalogValue(vcc)))
 
 if __name__ == "__main__":
 
-- 
2.24.0

