Discuss Scratch

RmnRss
New to Scratch
2 posts

Extension for 74HC165 Shift Register Control

Hi,

I'm trying to write an extension that could read the data coming from a 74HC165 shift register, but i can't figure out how to do it since the function i'm using is writing on (to send the data on the pin i want to read ) and reading from the Arduino at the same time.

Here is what i have so far :

[“r”,
“Lire l'état de %d.entrees_binaires”,
“getBinaryIn”,
“E1”,
],

ext.getBinaryIn = function(nextID, entree_binaire_select){
var deviceId = 30;
var received = ;


runPackage(30, pins_reg, 0); //digitalWrite(LOAD, LOW);
runPackage(30, pins_reg, 1); //digitalWrite(CLOCK, HIGH);

waitMilliseconds(0.005);

runPackage(30, pins_reg, 1); //digitalWrite(LOAD, HIGH);

waitMilliseconds(0.005);

for (var i = 0 ; i<8; ++i)
{
received = getPackage(nextID,deviceId,pins_reg);
runPackage(30, pins_reg, 1); //digitalWrite(CLOCK, HIGH);
runPackage(30, pins_reg, 0); //digitalWrite(CLOCK, LOW);
}

return received[entrees_binaires-1];

};

Am I doing something wrong ? Is there anyway to read and write in the same function ?

Thanks for your help,

Romain

Last edited by RmnRss (Feb. 21, 2018 09:08:48)

myeducate
Scratcher
500+ posts

Extension for 74HC165 Shift Register Control

The Arduino extension at scratchx.org has support for shift registers.

SPA Member and Assosiate - Creator and overlord of ScratchNetwork - 700+ Forum Posts - Web and Desktop Dev - Fluent in VB, PHP and HTML. I'm okay at CSS and Javascript but am still learning. Sig written in PHP using the picture libary. Firebase is fun.

RmnRss
New to Scratch
2 posts

Extension for 74HC165 Shift Register Control

Hi I picked up this project after four month and i still can't figure out how to do this.

Could you give me a link towards the extension you mentioned ? I can't find it.

Powered by DjangoBB

Standard | Mobile