Go to advanced search

by Krafter
Thu Oct 18, 2018 9:01 pm
Forum: Python
Topic: Variable passed to class
Replies: 9
Views: 585

Re: Variable passed to class

@Krafter, I should probably feel sheepish to say this now, (but maybe there's a lesson in not being bashful about exposing ugly code to the 'pundits' (all capable of writing ugly code themselves!)) If we had realized that's what you wanted to do we might have suggested you leave your code as it was...
by Krafter
Thu Oct 18, 2018 6:33 pm
Forum: Python
Topic: Variable passed to class
Replies: 9
Views: 585

Re: Variable passed to class

Well the overall code isn't the prettiest but it works. I created an RGB dictionary and I can change the elements of each from an external variable. Pretty simple change really. Thanks again for the tips. party_lib.py RGB = {'red': [100 ,0 ,0], 'grn': [0, 100, 0], 'blu': [0, 0, 100]} #etc.. micro_gu...
by Krafter
Wed Oct 17, 2018 10:05 pm
Forum: Python
Topic: Variable passed to class
Replies: 9
Views: 585

Re: Variable passed to class

Looks quite complicated and it might be better to not suggest anything until you've digested and modified things in the light of comments... but it's probably worth pointing out that you will find life easier if you avoid repeating stuff whenever you can. i.e elif mode ==1 and random == 0 and color...
by Krafter
Wed Oct 17, 2018 9:25 pm
Forum: Python
Topic: Variable passed to class
Replies: 9
Views: 585

Re: Variable passed to class

Ok. I'm going to add some snippets of my go and a little more description of what I want. I have a script that reads the values from an Allen Bradley PLC using PyComm . I have a graphical interface with the PLC and the Pi will read an integer for each color that is generated from the PLC. One for re...
by Krafter
Wed Oct 17, 2018 2:27 am
Forum: Python
Topic: Variable passed to class
Replies: 9
Views: 585

Variable passed to class

Yes, I'm sure this will be an easy answer but I'm a little confused. I have a library to control RGB Leds and I am working on a script to call different functions in that library. In the library, I also have a class that I'd like to pass a variable to. Below is the class. I'd like to have each eleme...
by Krafter
Fri Sep 01, 2017 4:41 pm
Forum: Troubleshooting
Topic: Pi3 hanging at rainbow screen
Replies: 35
Views: 28625

Re: Pi3 hanging at rainbow screen

I finally fix it: If it is a NOOBS install: In addition to updating the OS image you also have to update the kernel and firmware used by noobs. Otherwise your system will not boot on the new hardware. On the Pi2: First mount de noobs boot partition cd ~ mkdir testdisk sudo mount /dev/mmcblk0p1 test...
by Krafter
Wed Jul 26, 2017 7:28 pm
Forum: General discussion
Topic: PiVPN (OpenVPN) Need advice/help
Replies: 1
Views: 730

Re: PiVPN (OpenVPN) Need advice/help

Bump

Thanks
by Krafter
Tue Jul 25, 2017 7:54 pm
Forum: General discussion
Topic: PiVPN (OpenVPN) Need advice/help
Replies: 1
Views: 730

PiVPN (OpenVPN) Need advice/help

I wasn't sure where to post so I thought I'd post here so please move this if needed. I need some advice and/or help for a VPN using PiVPN (OpenVPN) on a Pi 3. I've googled and searched and pounded my head on my desk for days now trying to get a VPN up and running like I need it to. I've even posted...
by Krafter
Fri Apr 14, 2017 7:39 pm
Forum: General discussion
Topic: VPN help
Replies: 1
Views: 253

VPN help

I'm using a Raspberry Pi 3 as a VPN. I've successfully installed, setup and tested OpenVPN. This Pi has two network adapters plus the unused WiFi. I'm having problems trying to reach the second adapter when connected to the VPN. I thought it was a bridge that I was needing but now I'm not so sure. A...
by Krafter
Thu Aug 18, 2016 4:14 am
Forum: Python
Topic: Confused on if statment
Replies: 4
Views: 742

Re: Confused on if statment

Lol. Thanks for that. :D
by Krafter
Thu Aug 18, 2016 2:55 am
Forum: Python
Topic: Confused on if statment
Replies: 4
Views: 742

Re: Confused on if statment

Well I feel stupid on two different accounts. One is as you pointed out. I intended to add .02 to "current_time" and not .0002. The other reason is that "current_time" is continually updating. Therefore "current_time_plus" will never be less than current_time + .02...... Some minor rework and I'm su...
by Krafter
Thu Aug 18, 2016 2:31 am
Forum: Python
Topic: Confused on if statment
Replies: 4
Views: 742

Confused on if statment

If confused here. I'm using python for my project. Below are two different versions of an if statement. One works properly and the other doesn't but really should behave the same. I'd really like to get example 2 to work. current_time is a floating point. if current_time >= 21.35 and current_time <=...
by Krafter
Thu Aug 18, 2016 2:20 am
Forum: General discussion
Topic: Current draw
Replies: 4
Views: 861

Re: Current draw

Sorry for the late reply. You are correct. My measurements are low. For some odd reason, I'm getting different measurements when measuring in series on the 0 volts side than what I am measuring in series on the +12 Volts side (higher). I have no idea why. I'm using a Fluke 787 Process meter. Unfortu...
by Krafter
Tue Aug 09, 2016 1:47 am
Forum: General discussion
Topic: Current draw
Replies: 4
Views: 861

Current draw

I'm working on a project where current draw must be as low as possible. I have an external power source for the pi V2 and other components (12V reduced down to 5V). Right now with the components I have installed, I'm using 8.2 ma of power (12V side). But..... without the monitor hooked up via HDMI I...
by Krafter
Sat Jul 09, 2016 8:11 pm
Forum: General discussion
Topic: Raspberry Pi and 24LC256
Replies: 0
Views: 331

Raspberry Pi and 24LC256

Just starting in on the i2c protocol and all ready having issues. My goal in the end is to use a PICAXE as a ADC for a project I'm working on but thought I'd start with using an EEPROM chip 24LC256 just as an intro to i2c. I'm referring to this topic (post #14) on the PICAXE forums but when I read b...
by Krafter
Fri Feb 05, 2016 11:22 pm
Forum: Beginners
Topic: SPI and APA102
Replies: 13
Views: 9797

Re: SPI and APA102

Okay. I can certainly do that. But your reply, I take it that my code is okay? Your code wouldn't work, there are some brackets missing. This code lights a single LED in green on my APA102 strip: import spidev spi = spidev.SpiDev() spi.open(0,1) resp = spi.xfer([0x00, 0x00, 0x00, 0x00]) resp = spi....
by Krafter
Tue Feb 02, 2016 1:18 am
Forum: Beginners
Topic: SPI and APA102
Replies: 13
Views: 9797

Re: SPI and APA102

Tam wrote:I have all the code from https://github.com/tinue/APA102_Pi running on my Raspberry Pi using APA102 type led string, so the code does work ok.
Thanks for the input. I just ordered a couple of 74AHCT125. Hopefully that will cure my problem.
by Krafter
Thu Jan 28, 2016 11:51 pm
Forum: Beginners
Topic: SPI and APA102
Replies: 13
Views: 9797

Re: SPI and APA102

Okay. I can certainly do that. But your reply, I take it that my code is okay?

Thank you for your help. :D
by Krafter
Thu Jan 28, 2016 11:38 pm
Forum: Beginners
Topic: SPI and APA102
Replies: 13
Views: 9797

Re: SPI and APA102

Image folder Wire colors on the Pi Orange = 3.3v Red = 5v Black = Gnd Blue = MOSI Green = SCLK Wire colors on the Level Converter Yellow to LV = 3.3v Red to HV = 5v 1st Green to LV3 = SCLK on the Pi 1st Blue to LV4 = MOSI on the Pi 2nd Green to HV3 = SCLK on the LED 2nd Blue to HV4 = MOSI on the LE...
by Krafter
Thu Jan 28, 2016 10:09 pm
Forum: Beginners
Topic: SPI and APA102
Replies: 13
Views: 9797

Re: SPI and APA102

New info:

I just proved my level converter by wiring it up to an LED and flashing it with my Pi. It has to be in the code at this point. Any help with the basic setup for SPI and sending basic data would be great.

Thanks
by Krafter
Thu Jan 28, 2016 8:42 pm
Forum: Beginners
Topic: SPI and APA102
Replies: 13
Views: 9797

Re: SPI and APA102

That's where I started at but I couldn't get it to work. I couldn't even tell how to setup the SPI with his code and library so that's when I tried something more basic. I know how the APA102s work. You send it four bytes of 0x0s as an opening and then one byte of something for a global brightness a...
by Krafter
Wed Jan 27, 2016 11:49 pm
Forum: Beginners
Topic: SPI and APA102
Replies: 13
Views: 9797

SPI and APA102

Hi. I new at Raspberry Pis and SPI in general. I'm trying to get some APA102 LEDs working with my Pi. I've had great success at making them work with a PICAXE microcontroller but I can not seem to get them to work with my Pi. I've been do some reading and it seems that some APA102s work just fine wi...

Go to advanced search