This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Tests login and upload to an OpenStack Object Storage instance. | |
""" | |
import random | |
import subprocess | |
import unittest | |
import cloudfiles | |
from cloudfiles.errors import NoSuchContainer, AuthenticationFailed |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.IOException; | |
import java.net.URL; | |
import org.apache.http.HttpException; | |
import org.apache.log4j.BasicConfigurator; | |
import org.apache.log4j.Level; | |
import org.apache.log4j.Logger; | |
import org.testng.annotations.Test; | |
import com.rackspacecloud.client.cloudfiles.FilesAccountInfo; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class SomeTest(unittest.TestCase): | |
. | |
. | |
. | |
def test_queue(self): | |
. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
def rnd_byte(): | |
return chr(random.randint(0, 255)) | |
class FakeReadOnlyBinaryFile: | |
""" | |
File-like object for reading random data. The ammount of data to generate | |
is specified when the object is created. | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Test 74HC164 shift register | |
import time | |
from arduino_proxy import ArduinoProxy | |
def blink(): | |
print "blink()" | |
proxy.shiftOut(10, 11, ArduinoProxy.LSBFIRST, 0) | |
time.sleep(0.5) | |
proxy.shiftOut(10, 11, ArduinoProxy.LSBFIRST, 255) | |
time.sleep(0.5) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* FIRST EXAMPLE | |
*/ | |
var i; | |
for(i=2; i<=5; i++) { | |
proxy.pinMode(i, OUTPUT); | |
} | |
var j; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*********************************************************************** | |
* First example. Testing how to use LM335 to read temperature, | |
* using PyArduinoProxy. | |
***********************************************************************/ | |
var value = proxy.analogRead(0); | |
logMessage("analogRead(): " + value); | |
var volt = (5.0/1024.0) * value; | |
logMessage("volt: +" + volt +"V"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var ram = proxy.globalData()['arduino_type_struct']['ram_size_bytes']; | |
var free = proxy.getFreeMemory(); | |
var pc = Math.floor((free/ram)*100); | |
logMessage("Free ram: " + free + " bytes of " + ram + " bytes (" + pc + "% free)."); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ArduinoProxy(object): | |
(...) | |
def getFreeMemory(self): | |
val = self.send_cmd("_gFM") | |
return val | |
getFreeMemory.arduino_function_name = '_gFM' | |
getFreeMemory.arduino_code = """ |
OlderNewer